SAP ST TT SERIALIZE DESERIALIZE
Get Example source ABAP code based on a different SAP table
ARTICLE
Syntax
...
<(><<)>/tt:serialize>
<(><<)>tt:deserialize>
...
<(><<)>/tt:deserialize>
Effect
You can use these
All the template elements listed within the
Example
The following Simple Transformation serializes a structure and deserializes to an internal table:
xmlns:tt='http://www.sap.com/transformation-templates'>
<(><<)>tt:root name='ROOT1'/>
<(><<)>tt:root name='ROOT2'/>
<(><<)>tt:template>
<(><<)>X>
<(><<)>tt:serialize>
<(><<)>Y>
<(><<)>tt:value ref='.ROOT1.COL1' />
<(><<)>/Y>
<(><<)>Y>
<(><<)>tt:value ref='.ROOT1.COL2' />
<(><<)>/Y>
<(><<)>Y>
<(><<)>tt:value ref='.ROOT1.COL3' />
<(><<)>/Y>
<(><<)>/tt:serialize>
<(><<)>tt:deserialize>
<(><<)>tt:loop ref='.ROOT2'>
<(><<)>Y>
<(><<)>tt:value/>
<(><<)>/Y>
<(><<)>/tt:loop>
<(><<)>/tt:deserialize>
<(><<)>/X>
<(><<)>/tt:template>
<(><<)>/tt:transform>
The following ABAP program can call the transformation:
DATA: BEGIN OF struc,
col1 TYPE i VALUE 1,
col2 TYPE i VALUE 2,
col3 TYPE i VALUE 3,
END OF struc.
DATA itab TYPE TABLE OF i.
CALL TRANSFORMATION ...
SOURCE root1 = struc
RESULT XML xml_string.
CALL TRANSFORMATION ...
SOURCE XML xml_string
RESULT root2 = itab.
After deserialization, the internal table contains three rows with the values of the structure components.