Skip to Content
avatar image
Former Member

How to find the language of a string in sap scripts maintaining EN JP as languages

Hi

I do have one peculiar requirement.

I need to check the language of that string, based on the logic I need to do other things.

could anybody let me know how to find the language of the string(note: it's not standard text, it's just a string)

best regards

Venu

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 05, 2017 at 02:57 PM

    You could look for CJK (Chinese, Japanese, Korean) characters in the string (4E00–9FEA?)

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 03:33 PM

    To break it down into the details. You would need to define a subroutine and call it from the Sapscript(you pass the string and change a var that indicates if its English or not, you can find examples online like so). In it, you check to see if it's English or not, I would use Regex .

    Something like this (I'm not infront of SAP system, son this is an unchecked code regex is based on this):

    FIND REGEX ‘[^\x00-\x7F]+’ IN lv_string.
    IF sy-subrc EQ 0.
       "Not English
    ELSE.
       "English
    ENDIF.
    Add comment
    10|10000 characters needed characters exceeded