Thursday, September 1, 2011

Function Module Replace Strange Char

Replace non-standard characters with standard characters
for example ǽ will be replaced by "." 
É will be replaced by 'E'.

Function Module: SCP_REPLACE_STRANGE_CHARS

Sample:


CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
  EXPORTING
     intext =                   " Input Text
*   intext_lg = 0           " i Number of Bytes in the Input Text
*   inter_cp = '0000'   " tcp00-cpcodepage  Intermediate character set with replacements
*   inter_base_cp = '0000'   " tcp00-cpcodepage  Basis Code Page for 'INTER_CP'
*   in_cp = '0000'             " tcp00-cpcodepage  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   " Unknown character set
    CODEPAGE_MISMATCH = 2  " Intermediate character set does not fit the system character set
    INTERNAL_ERROR = 3     " Internal error
    CANNOT_CONVERT = 4     " There was no replacement for a char. in INTEXT
    FIELDS_NOT_TYPE_C = 5. " Fields passed must be type C

No comments:

Post a Comment