Skip to main content

Restrict lowercase and special characters when adding new records

Answered

Comments

25 comments

  • Ramon Duunk

    Why dont you use a B1 validation on add/update and a macro that uppercase those fields ?

    As reference :

  • Nemo

    Thanks for the reply Ramon, i will test out your reference from the screenshot.

    Does the code prevent special characters too? 

  • Ramon Duunk

    Hi Nemo,

    No this only uppercases whatever is typed in the field as long as it's not empty.
    We need the special characters :)

  • SSP Automation
    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]
  • Nemo

    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?  

  • Nemo

    Hi Ramon,

    i have set the below and i cant see the error it is popping up with. Can you assist? 

  • Ramon Duunk

    If you use LEN, you need to specify a length of characters instead of IS NOT NULL

  • Nemo

    I have tried the same as yours and still same error.

  • Ramon Duunk

    Can you turn on the debug ?
    runs fine here....

     

  • Nemo

    hmm, Debug is clicked below --> restarted SAP and getting same error

  • Ramon Duunk

    you need to trigger the function on the item master data to start debugging.

  • Nemo

    Yep thats what i have done and its showing the same error as previous.

  • Ramon Duunk

    Hi Nemo,

    I was expecting this screen : (the debugger)

  • Nemo

    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? 

  • Nadav Caridi

    you can check for special chars with tsql

    DECLARE @str nvarchar(max)='test'

    SELECT 1 WHERE @str NOT LIKE '%[^a-zA-Z0-9]%'

  • Nemo

    @ Ramon Duunk,

    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]

     

     

  • Nemo

    @Nadav Caridi,

    Ive converted your query to Hana, applied the below and getting error.

    Do you have a screenshot of how this is set up? thanks 

     

  • Nadav Caridi

    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

  • Nemo

    Nadav Caridi, i have applied the HANA converted codes as below and restarted B1UP addon and am getting the error below..

  • Nadav Caridi

    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. 

     

  • Nemo

    have tried below. it doesnt do anything and allow me to update or add.

     

    it must be related to 

  • Nadav Caridi

    Hi,

    Have you tried running it as a sql report , with a function button ? (see my screenshot in previous reply)

  • Nemo

    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...

  • Nemo

    Hi,

    Yep, getting the below 

  • Nemo

    then i have tried the below with the error.

Please sign in to leave a comment.