Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  ST - Simple Transformations →  ST - Serialization and Deserialization →  ST - Transformation of ABAP Values 

ST - tt:value, Structures

Other versions: 7.31 | 7.40 | 7.54

Syntax


<tt:value [ref="node"] [map="..."] 
                       [length|minLength|maxLength="len"]
                       [xsd-type...] />

Effect

The serialization and deserialization of structures results directly from the addressing rules, because the structures can be mapped directly to the tree structures that start from the data roots. When the current node is bound to an elementary component of an ABAP structure, the structure can be processed with tt:value just like an elementary data object.

Examples

The three ST programs from the sections

can transform a nested ABAP structure symmetrically. The following program can call these three ST programs:

DATA: BEGIN OF struc1,
        col1(10) TYPE c VALUE 'ABCDEFGHIJ',
        col2     TYPE i VALUE 111,
        BEGIN OF struc2,
          col1 TYPE d VALUE '20040126',
          col2 TYPE t VALUE '084000',
        END OF struc2,
      END OF struc1.

DATA: xml_string TYPE string,
      result LIKE struc1.

TRY.
    CALL TRANSFORMATION ...
      SOURCE root = struc1
      RESULT XML xml_string.
    cl_abap_browser=>show_xml( EXPORTING xml_string = xml_string ).
    CALL TRANSFORMATION ...
      SOURCE XML xml_string
      RESULT root = result.
    IF struc1 <> result.
      MESSAGE 'Deserialization <> Serialization' TYPE 'I'.
    ENDIF.
  CATCH cx_st_error.
  ...
ENDTRY.

The result of the serialization is the same XML data for all three simple transformations:

<X>
  <X1>ABCDEFGHIJ</X1>
  <X2>111</X2>
  <X3>
    <X1>2004-01-26</X1>
    <X2>08:40:00</X2>
  </X3>
</X>