Start of Content Area

Syntax documentation Defining the Transformation Direction  Locate the document in its SAP Library structure

You can use the following ST commands to limit parts of templates for execution during serialization or deserialization:

 

<tt:serialize>
  ...

</tt:serialize>

 

<tt:deserialize>
  ...

</tt:deserialize>

 

All the template elements listed within the tt:serializeelement are only considered during serialization. All the template elements listed within the tt:deserialize element are only considered during deserialization.

 

Example

The following simple transformation serializes a structure and deserializes to an internal table:

 

<tt:transform 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 xml_string TYPE string.

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.

 

 

End of Content Area