Enterprise Resource Planning Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
yashoratna
Active Participant
0 Kudos
1,023

Introduction: I recently encountered an odd problem when reading data from the material master database table. It had a few strange characters. Though I couldn't see anything in the GUI with my bare eyes except some spaces (Image 1), something was buried behind the spaces. However, it was transmitting all wacky characters (Image 2) when we started to send the description to the third-party system. As a result, the third-party system was broken and was unable to evaluate the data.

Image 1:

snap519.png

Image 2: 

snap520.png

Solution: To eliminate all of these odd characters from the description, we can utilize SAP's Function Module 'SCP_REPLACE_STRANGE_CHARS'. It works on the codepage principle. To eliminate all of these characters, we simply set replacement as 32, the ASCII character of space. Additionally, for the the correct result, we must pass inter_cp as '1101' and inter_base_cp as '4110'. 

 

 

DATA: lv_maktx TYPE maktx,
      lv_outtext TYPE maktx.
CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
        EXPORTING
          intext            = lv_maktx
          inter_cp          = '1101'
          inter_base_cp     = '4110'
          replacement       = 32
        IMPORTING
          outtext           = lv_outtext
        EXCEPTIONS
          invalid_codepage  = 1
          codepage_mismatch = 2
          internal_error    = 3
          cannot_convert    = 4
          fields_not_type_c = 5
          OTHERS            = 6.
      IF sy-subrc EQ 0.
      ENDIF.

 

 

And as you can see below, the final output no longer contains any odd alias characters that appear goofy.

snap522.png

I sincerely hope you found this content interesting to read. At any moment, I would welcome your opinions and recommendations. And once again, many thanks for your valuable time.