Tuesday, April 12, 2016

Serialize / Deserialize in ABAP

  data lt_complex type gtt_complex.
  data lo_ser type ref to cl_trex_json_serializer.
  data lo_des type ref to cl_trex_json_deserializer.
  data lv_json type string.
  data lv_s type string.
  data lt_s type standard table of string.

  create object lo_ser
    exporting
      data = lt_complex.

  lo_ser->serialize( ) .
  lv_json = lo_ser->get_data( ).

  split lv_json at ', ' into table lt_s.
  loop at lt_s into lv_s.
    write / lv_s.
  endloop.

  create object lo_des.
  lo_des->deserialize(
    exporting json = lv_json
    importing abap = lt_complex
  ).

No comments:

Post a Comment

Working with the session Id // ID für den Modus

Sometimes it can be helpful to know the id of the current session     CALL FUNCTION 'TH_GET_CONTEXT_ID'       IMPORTING         cont...