Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Serialize deep-structure to XSTRING

former_member186608
Active Participant
0 Likes
1,896

Hi people,

I have a deep structure whose components are of type CString and P and need to serialize it into a XSTRING variable.

All approaches and FMs I found only work with flat and char-like structures.

Of couse I could loop at all components of the structure and use ASSIGN COMPONENT to access all individual values and convert each value on my own. However, due to performance reasons I am looking for a built-in ABAP functionality that provides the binary representation of such a structure.

Any ideas?

Thanks!

Marco

2 REPLIES 2
Read only

kirill_smirnov
Explorer
0 Likes
1,028

Hi Marco,

Did you try to serialize your data to JSON using something like this:

DATA:
       lo_json_writer TYPE REF TO cl_sxml_string_writer.

  lo_json_writer = cl_sxml_string_writer=>create(
            type = if_sxml=>co_xt_json ).
  TRY.
      CALL TRANSFORMATION id
      SOURCE tab = it_table[]
      RESULT XML  lo_json_writer.
    CATCH cx_root.
      CLEAR ev_xjson.
      RETURN.
  ENDTRY.

  CALL METHOD lo_json_writer->get_output
    RECEIVING
      output = ev_xjson.

  FREE lo_json_writer.

KS

Read only

0 Likes
1,028

Hi Kirill,

thanks for your suggestion.

Yes I tried that approach already. However, in case of huge data volumes JSON is not efficient enough as exchange format between systems. For this purpose I am looking for a possibiltiy to transfer data on a binary level.

Best,

Marco