06-09-2021 4:01 PM
Hi,
I apologise in advance for the dumb questions I post here.
I would like to test a file on the SAP server for unicode errors, and replace the faulty characters with a default character. For example, we might have 'iński' where the ń is not recognized in our system. What we see in AL11 is in fact 'iE#ski' i.e. the string become longer by 1 character. I am thinking of doing this as per the code below.
DATA: ltext(340).
OPEN DATASET sp_filei FOR INPUT IN TEXT MODE ENCODING UTF-8.
DO.
READ DATASET sp_filei INTO ltext.
IF sy-subrc <> 0.
EXIT.
ENDIF.
TRY.
conv = cl_abap_conv_x2x_ce=>create(
in_encoding = '4102'
out_encoding = '4110'
input = gv_xstring ).
CATCH cx_sy_codepage_converter_init.
MESSAGE a218(fz) WITH in_encoding '4110'.
ENDTRY.
This of course doesn't work because I am reading the values into a text field and not xstring, however when I use xstring the program dumps.
I need somehow to pick up that that there is a faulty character, in this case 'ń' and replace it with the value available in our mapping table i.e. 'n' (a normal n).
All help greatly appreciated.
06-09-2021 4:52 PM