SAP Function SCP_REPLACE_STRANGE_CHARS - Replace non-standard characters with standard characters

Parameter Reference Type Length Default Optional Text
INTER_BASE_CP TCP00-CPCODEPAGE N 4 '0000' X Basis Code Page for 'INTER_CP'
INTER_CP TCP00-CPCODEPAGE N 4 '0000' X Intermediate character set with replacements
INTEXT 0 Input text
INTEXT_LG I I 4 0 X Number of Bytes in the Input Text
IN_CP TCP00-CPCODEPAGE N 4 '0000' X Char. set of INTEXT (if not system char. set)
REPLACEMENT 0 46 X '0' or the replacement character

Parameter Reference Type Length Text
OUTOVERFLOW 0 'X':Output text incomplete, ' ':otherwise
OUTTEXT 0 Output text
OUTUSED 0 Output text length

Exception Text
CANNOT_CONVERT There was no replacement for a char. in INTEXT
CODEPAGE_MISMATCH Intermediate character set does not fit the system character set
FIELDS_NOT_TYPE_C Fields passed must be type C
INTERNAL_ERROR Internal error
INVALID_CODEPAGE Unknown character set

Functionality
SCP_REPLACE_STRANGE_CHARS processes a text so that it onlycontains simple characters. Special characters and national charactersare replaced in such a way that the text remains reasonably legible.
The character set 1146 is used by default. In this case thefollowing replacements are made, for example:
<225> ==> AE (AE)
<257> ==> A (Acircumflex)
<258> ==> Ae (Adieresis)
<163> ==> L (sterling)
Note that the new text can be longer than the old.

The parameters:
INTEXT contains the text to be processed. The parameters passedmust be of TYPE C. Blank characters at the end of INTEXT are notprocessed.
The result is written in OUTTEXT. (TYPE C)
The length of the output text is written in OUTUSED. If OUTTEXTis longer, the rest is filled with SPACE.
An 'X' is written in OUTOVERFLOW if the output text did not fitin OUTTEXT. Otherwise space.
With IN_CP you can specify that the data in INTEXT is notin the system character set, but is coded in the character setIN_CP.
If IN_CP differs from the current code page to such an extent that theblank charcters at the end of INTEXT may not be clearly recognized, youcan specify the number of bytes that are to be taken from INTEXT inINTEXT_LG . (Caution: In Unicode systems the number of bytes isgreater than the number of characters.)
With INTER_CP you can specify another character set which is tobe used for the replacement. 1146 is the default.
The function module makes use of the fact that 1146 is a sub-codepageof 1100. If you set a code page with INTER_CP that is neither asub-codepage of 1100 nor belongs to the same code page family as IN_CP,you can use INTER_BASE_CP to specify the code page thatincorporates INTER_CP.
If there are characters which do not occur in one or other of the twocharacter sets, they are replaced by a period ("."). This can bechanged with the parameter REPLACEMENT. An SAP character numbermust be specified. A 0 means that no replacements should bemade. In such a case, the exception CANNOT_CONVERT is generated.

EXCEPTIONS
CANNOT_CONVERT means that a character occured in the data thatcould not be replaced, and at the same time replacement was forbiddenby REPLACEMENT.
If you specify a character set that does not exist in IN_CP orINTER_CP, you get INVALID_CODEPAGE.
The system checks whether the two character sets are compatible (forexample, ASCII). Otherwise there is a CODEPAGE_MISMATCH.
If INTEXT or OUTTEXT is not of type C (text field), thefunction module cannot process them and generates aFIELDS_NOT_TYPE_C.
INTERNAL_ERROR should never occur.

Notes
If you want only uppercase letters, you should first callSCP_REPLACE_STRANGE_CHARS and then TRANSLATE TO UPPER CASE. Example
A umlaut ==> Ae ==> AE

Further information
RSCP0007 is a test harness.

1621400Replace Illegal Characters in IDM Process Chain
1423651Code pages 1146 and 1155 in 'F5-memory'
1062237Transliteration of characters with SCP_REPLACE_STRANGE_CHARS
744100transliteration of Hebrew