SAP SCP_REPLACE_STRANGE_CHARS Function Module for Replace non-standard characters with standard characters
SCP_REPLACE_STRANGE_CHARS is a standard scp replace strange chars SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Replace non-standard characters with standard characters processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for scp replace strange chars FM, simply by entering the name SCP_REPLACE_STRANGE_CHARS into the relevant SAP transaction such as SE37 or SE38.
Function Group: SCPC
Program Name: SAPLSCPC
Main Program: SAPLSCPC
Appliation area: S
Release date: 05-Jan-1995
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SCP_REPLACE_STRANGE_CHARS pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'"Replace non-standard characters with standard characters.
EXPORTING
INTEXT = "Input Text
* INTEXT_LG = 0 "Number of Bytes in the Input Text
* INTER_CP = '0000' "Intermediate character set with replacements
* INTER_BASE_CP = '0000' "Basis Code Page for 'INTER_CP'
* IN_CP = '0000' "Char. set of INTEXT (if not system char. set)
* REPLACEMENT = 46 "'0' or the replacement character
IMPORTING
OUTTEXT = "Output text
OUTUSED = "Output text length
OUTOVERFLOW = "'X':Output text incomplete, ' ':otherwise
EXCEPTIONS
INVALID_CODEPAGE = 1 CODEPAGE_MISMATCH = 2 INTERNAL_ERROR = 3 CANNOT_CONVERT = 4 FIELDS_NOT_TYPE_C = 5
IMPORTING Parameters details for SCP_REPLACE_STRANGE_CHARS
INTEXT - Input Text
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTEXT_LG - Number of Bytes in the Input Text
Data type: IOptional: Yes
Call by Reference: No ( called with pass by value option)
INTER_CP - Intermediate character set with replacements
Data type: TCP00-CPCODEPAGEDefault: '0000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
INTER_BASE_CP - Basis Code Page for 'INTER_CP'
Data type: TCP00-CPCODEPAGEDefault: '0000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
IN_CP - Char. set of INTEXT (if not system char. set)
Data type: TCP00-CPCODEPAGEDefault: '0000'
Optional: Yes
Call by Reference: No ( called with pass by value option)
REPLACEMENT - '0' or the replacement character
Data type:Default: 46
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for SCP_REPLACE_STRANGE_CHARS
OUTTEXT - Output text
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OUTUSED - Output text length
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OUTOVERFLOW - 'X':Output text incomplete, ' ':otherwise
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INVALID_CODEPAGE - Unknown character set
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CODEPAGE_MISMATCH - Intermediate character set does not fit the system character set
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR - Internal error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CANNOT_CONVERT - There was no replacement for a char. in INTEXT
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FIELDS_NOT_TYPE_C - Fields passed must be type C
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SCP_REPLACE_STRANGE_CHARS Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_intext | TYPE STRING, " | |||
| lv_outtext | TYPE STRING, " | |||
| lv_invalid_codepage | TYPE STRING, " | |||
| lv_outused | TYPE STRING, " | |||
| lv_intext_lg | TYPE I, " 0 | |||
| lv_codepage_mismatch | TYPE I, " | |||
| lv_inter_cp | TYPE TCP00-CPCODEPAGE, " '0000' | |||
| lv_outoverflow | TYPE TCP00, " | |||
| lv_internal_error | TYPE TCP00, " | |||
| lv_inter_base_cp | TYPE TCP00-CPCODEPAGE, " '0000' | |||
| lv_cannot_convert | TYPE TCP00, " | |||
| lv_in_cp | TYPE TCP00-CPCODEPAGE, " '0000' | |||
| lv_fields_not_type_c | TYPE TCP00, " | |||
| lv_replacement | TYPE TCP00. " 46 |
|   CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS' "Replace non-standard characters with standard characters |
| EXPORTING | ||
| INTEXT | = lv_intext | |
| INTEXT_LG | = lv_intext_lg | |
| INTER_CP | = lv_inter_cp | |
| INTER_BASE_CP | = lv_inter_base_cp | |
| IN_CP | = lv_in_cp | |
| REPLACEMENT | = lv_replacement | |
| IMPORTING | ||
| OUTTEXT | = lv_outtext | |
| OUTUSED | = lv_outused | |
| OUTOVERFLOW | = lv_outoverflow | |
| EXCEPTIONS | ||
| INVALID_CODEPAGE = 1 | ||
| CODEPAGE_MISMATCH = 2 | ||
| INTERNAL_ERROR = 3 | ||
| CANNOT_CONVERT = 4 | ||
| FIELDS_NOT_TYPE_C = 5 | ||
| . " SCP_REPLACE_STRANGE_CHARS | ||
ABAP code using 7.40 inline data declarations to call FM SCP_REPLACE_STRANGE_CHARS
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single CPCODEPAGE FROM TCP00 INTO @DATA(ld_inter_cp). | ||||
| DATA(ld_inter_cp) | = '0000'. | |||
| "SELECT single CPCODEPAGE FROM TCP00 INTO @DATA(ld_inter_base_cp). | ||||
| DATA(ld_inter_base_cp) | = '0000'. | |||
| "SELECT single CPCODEPAGE FROM TCP00 INTO @DATA(ld_in_cp). | ||||
| DATA(ld_in_cp) | = '0000'. | |||
| DATA(ld_replacement) | = 46. | |||
Search for further information about these or an SAP related objects