Restrict lowercase and special characters when adding new records Respondida

Nemo

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

Comentarios

25 comentarios

  • Comment author
    Ramon Duunk
    • Editado

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

    As reference :

    0
  • Comment author
    Nemo

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

    Does the code prevent special characters too? 

    0
  • Comment author
    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 :)

    0
  • Comment author
    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]
    0
  • Comment author
    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?  

    0
  • Comment author
    Nemo

    Hi Ramon,

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

    0
  • Comment author
    Ramon Duunk

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

    0
  • Comment author
    Nemo

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

    0
  • Comment author
    Ramon Duunk

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

     

    0
  • Comment author
    Nemo

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

    0
  • Comment author
    Ramon Duunk

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

    0
  • Comment author
    Nemo

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

    0
  • Comment author
    Ramon Duunk

    Hi Nemo,

    I was expecting this screen : (the debugger)

    0
  • Comment author
    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? 

    0
  • Comment author
    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]%'

    0
  • Comment author
    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]

     

     

    0
  • Comment author
    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 

     

    0
  • Comment author
    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

    0
  • Comment author
    Nemo

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

    0
  • Comment author
    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. 

     

    0
  • Comment author
    Nemo

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

     

    it must be related to 

    0
  • Comment author
    Nadav Caridi

    Hi,

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

    0
  • Comment author
    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...

    0
  • Comment author
    Nemo

    Hi,

    Yep, getting the below 

    0
  • Comment author
    Nemo

    then i have tried the below with the error.

    0

Iniciar sesión para dejar un comentario.