Skip to Content
0
Feb 04, 2021 at 08:37 AM

How to split string to itab without remove character in string.

223 Views

Hi Expert,

Please let me know if it possible split string to itab without removing character in string ?

i have variable like this,

DATA : response     TYPE string VALUE '{"success":"false","msg":"Not valid","matnr":"1234","matkl":"123489"},{"success":"true","msg":" valid","matnr":"PH X 15","matkl":"123433"}',

and then i do split,

 SPLIT response AT '},' INTO TABLE DATA(lv_line).

    LOOP AT lv_line INTO ls_line.
      CALL METHOD cl_fdt_json=>json_to_data
        EXPORTING
          iv_json = ls_line
        CHANGING
          ca_data = ls_data_json.

      APPEND ls_data_json TO lt_data_json.
    ENDLOOP.

when i using cl_fdt_json , field matkl at first row is initial.
because the value string as be : {"success":"false","msg":"Not valid","matnr":"1234","matkl":"123489".

but i need value as be : {"success":"false","msg":"Not valid","matnr":"1234","matkl":"123489"} <--