Restrict lowercase and special characters when adding new records
AnsweredHi experts,
I am looking to restrict fields from the Item master data and business partner master data fields to only accept CAPTIALS and non special characters such as /,.-'+=!` etc...
e.g. ITEM001 is allowed and item-001 is not allow when adding new records.
In the past users forgets to follow company rules and this causes a mess with lowercase item codes and BP codes such is annoying when creating reports.
-
Why dont you use a B1 validation on add/update and a macro that uppercase those fields ?
As reference :

-
Thanks for the reply Ramon, i will test out your reference from the screenshot.
Does the code prevent special characters too?
-
Hi Nemo,
No this only uppercases whatever is typed in the field as long as it's not empty.
We need the special characters :) -
Thank you for your request. It has been scheduled for review by the development team that will get back to you should there be questions.
(Please note that as we are user-driven we can't guarantee that your request will be met unless it gets many votes and/or fit the product vision)
Read more about the Feature Request process here
[Internal Id: 84401] -
Hi Ramon,
That would be half of our issue resolved. just need to prevent the special characters. would you know the syntax to restrict special characters?
-
Hi Ramon,
i have set the below and i cant see the error it is popping up with. Can you assist?

-
If you use LEN, you need to specify a length of characters instead of IS NOT NULL
-
I have tried the same as yours and still same error.

-
Can you turn on the debug ?
runs fine here.... -
hmm, Debug is clicked below --> restarted SAP and getting same error

-
you need to trigger the function on the item master data to start debugging.
-
Yep thats what i have done and its showing the same error as previous.

-
Hi Nemo,
I was expecting this screen : (the debugger)

-
When clicking the ? on the debug i see what you're referring to but it doesnt appear for myself. We're using v10 HANA and maybe this is not available?

-
you can check for special chars with tsql
DECLARE @str nvarchar(max)='test'
SELECT 1 WHERE @str NOT LIKE '%[^a-zA-Z0-9]%'
-
I've managed to get this to work using the below as it is HANA.
result turns the field in Uppercase as require. many thanks for your help:)

However i have changed this to apply to the ItemCode field as this is my intented field.
Although it works fine when adding new itemcode. When i then try to update it is erroring the below:
I have even changed the settings to ADD mode only and it is behaving the same


(1299) no data found: "SBODEMOGB"."SBO_SP_TRANSACTIONNOTIFICATION": line 29 col 4 (at pos 832): "SBODEMOGB"."BEAS_SP_TRANSACTIONNOTIFICATION": line 1624 col 5 (at pos 125047):
and
Error: No matching records found 'Items' (OITM) (ODBC -2028) [Message 131-183]
-
Ive converted your query to Hana, applied the below and getting error.
Do you have a screenshot of how this is set up? thanks

-
Hi,
Not sure about the Hana syntax , thought it's a regular Tsql.
Try just doing it without the variable as follows in the sql condition (?) , also replace the field you query with your field (the dynamic field)
IF(1=(SELECT 1 WHERE $[$5.0.0] LIKE '%[^a-zA-Z0-9]%'))
BEGIN
SELECT 'specialChars'
FOR BROWSE
END
-
Nadav Caridi, i have applied the HANA converted codes as below and restarted B1UP addon and am getting the error below..

-
Hi
Bummer, I'm Sorry but I'm using MSSQL and that works fine in managment studio + SBO.
Do you have some sort of Query tool in HANA where you can go though the syntax and see where the TSQL error is ?

If nothing else , I suppose you can use .net snippets. but that just feels like a lot of trouble for something quite simple in one line sql.
-
have tried below. it doesnt do anything and allow me to update or add.

it must be related to

-
Hi,
Have you tried running it as a sql report , with a function button ? (see my screenshot in previous reply)
-
I think i will skip the special characters restriction for now.
On to the Uppercase, what changes is needed to restrict the amount of characters the users can enter?
e.g. I do not want the users to add crazy long Itemcode and restrict to <=10 characters.
tried
SELECT CASE
WHEN LENGTH($[$186.0.0]) >= 10 but nothing happens...
-
Hi,
Yep, getting the below

-
then i have tried the below with the error.

Please sign in to leave a comment.
Comments
25 comments