Copyright 2024 - BV TallVision IT

Would you like to get rid of spêciãl characters ? Here's how to do that using TRANSLATE.

The TRANSLATE statement has a translation feature that works with a string of translations, effectively a string of e.e. special characters followed by the character it should be translated to, like so:

  CONSTANTS: co_specials(116) VALUE
      'âaäaàaåaáaãaæaÄAÅAÁAÂAÀAÃAéeêeëeèeÉEÊEËEÈEïiîiìiíiÍIÎIÏIÌI' &

  TRANSLATE wa_textline USING co_specials.

An alternative way to tackle umlaut's and such - specifically for an HTML output (thus e.g. ü will be converted to ü):

CALL METHOD cl_hrrcf_cs_sf=>replace_special_character
     cv_letter_content = lv_whatever_needs_cleaning.

There is also:

  • a function module SCP_REPLACE_STRANGE_CHARS - Replace non-standard characters with standard characters.
  • There is also a class available for string matters, check out CL_ABAP_CHAR_UTILITIES which also holds constants for special characters like the FORM_FEED or the NEWLINE character.