2009 Nov 26 11:20 PM
Hi All,
I need to replace the accented characters from a string with normal character .
In the string "Rössing Uranium Limited" & "Prüflos für Prüfung freigeben" i need to remove accented characters with "o" and "u" respectively.
I have tried using below FMs but this could not help
1. SF_SPECIALCHAR_DELETE.
2. SCP_REPLACE_STRANGE_CHARS.
3. TELNUMBER_REMOVE_SPECIAL_CHAR and some other FMs too.
Please could you let me know if there is any FM or logic to replace such characters.
Thanks,
Mars
2009 Nov 27 2:57 AM
Hi,
do you want to find a FM that can replace all special character automatically?
if not, I think you can just use replace statement like below:
lv_tmp = 'Prüflos für Prüfung freigeben'.
REPLACE ALL OCCURRENCES OF REGEX 'ü' IN lv_tmp WITH 'u'.
2009 Nov 27 3:21 AM
I do not think there is FM to process this. you may need create on FM to process it by yourself.
2009 Nov 27 3:24 AM
You have to code your own logic.
It will be easy if you know what will be the special characters.
2009 Nov 27 5:35 AM
fm SCP_REPLACE_STRANGE_CHARS should work for sure.
Read the documentation its says that.
can you test this .. just a try
REPLACE ALL OCCURRENCES OF REGEX '[$1(\P{M}\p{M})]' IN lv_str WITH space.
or
REPLACE ALL OCCURRENCES OF REGEX '[$1(\P{M}\p{M})]' IN lv_str WITH '([aeiou])'.
Edited by: ksd on Nov 27, 2009 11:15 AM
2009 Nov 27 6:43 AM
Hi Mars,
See this code snippet.
DATA: gv_in TYPE string,
gv_out TYPE string.
gv_in = 'Rössing Uranium Limited" & "Prüflos für Prüfung freigeben'.
CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
EXPORTING
intext = gv_in
IMPORTING
outtext = gv_out.
WRITE gv_out.Input: Rössing Uranium Limited" & "Prüflos für Prüfung freigeben'
Output: Roessing Uranium Limited" & "Prueflos fuer Pruefung freigebenThanks
2014 Feb 06 5:47 PM
To convert accents in non-accented chars you can use the FM "HR_BR_CONVERT_ACCENTS".