I have a string which is looking like this for example Lübeck Nürnberg Österreich
with "Umlaute".
Now I want to split
it and add the new "words" on the string like this Lübeck Nürnberg Österreich Luebeck Nuernberg Oesterreich
.
So ä
should be ae
, ö
should be oe
and ü
should be ue
.
But I have no clue how to achieve this, thank you!
DATA: lt_split TYPE TABLE OF char40.
SPLIT string AT space INTO TABLE lt_split.
You can use REPLACE to replace a string with another string inside a string:
REPLACE ALL OCCURENCES OF: 'ä'
IN string
WITH 'ae',
'ü'
IN string
WITH 'ue'.
There is another variation of this statement, it can be used with an internal table:
REPLACE 'ä'
IN TABLE lt_split
WITH 'ae'.
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/de-DE/abapreplace_in_pattern.htm
Please note, the new string will be longer (if at least one replacement happened), this can be a problem, if the string was character type with fixed length and the new string would be longer, than allowed.