Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Remove Accented Character from string

Former Member
0 Likes
7,998

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

6 REPLIES 6
Read only

peter_peng
Product and Topic Expert
Product and Topic Expert
0 Likes
3,827

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

Read only

Former Member
0 Likes
3,827

I do not think there is FM to process this. you may need create on FM to process it by yourself.

Read only

Former Member
0 Likes
3,827

You have to code your own logic.

It will be easy if you know what will be the special characters.

Read only

kesavadas_thekkillath
Active Contributor
3,827

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

Read only

Former Member
3,827

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 freigeben

Thanks

Read only

Former Member
0 Likes
3,827

To convert accents in non-accented chars you can use the FM  "HR_BR_CONVERT_ACCENTS".