What does it do? Internal tables are serialized and deserialized within a loop defined by tt:loop> that sets the current node> to the current table line. The optional attribute ref> can be used to define the current node for the statement. If ref> is not specified, the current node of the surrounding element is used implicitly. The ABAP data object that is bound to the current node must be an internal table. The name> attribute can be used to define an alias> for the current node within the loop. In the tt:loop> loop, the current node can then be addressed with $alias>. When nested loops are used, the alias allows access to the current nodes of outer loops. If only one loop is used and in the outermost loop, $alias> is equivalent to $ref> when entering the loop.
Serialization In serializations, a loop is run for the entire internal table. If the internal table is blank, processing continues after the element. In each loop pass, the current node of a data node is set further and the current ABAP table line is bound to the data node. The content of element tt:loop>, which can contain any template elements, is processed for each data node.
Deserialization In deserializations, the ABAP table is initialized and the content of element tt:loop> is also executed in a loop. The XML data continues to be processed until a position is reached that cannot be processed with the content of the element. A new line is created in the bound ABAP table for each loop pass and is in turn bound to the current node. The XML values that are deserialized in the current loop pass are passed on to the current table line.
Latest notes:
If it must be possible to deserialize a transformation, it must be possible to end loop executions properly, especially in the case of nested tt:loop> loops. This is the case when the content of a tt:loop> element can be compared with the sections to be deserialized. If the XML elements in a loop are not sufficient, the entire loop body can be enclosed with a literal XML element, for example, which defines a hierarchy level that can be evaluated in deserializations.
In a Simple Transformation, a data node must be handled either exclusively as an internal table or not at all as an internal table. In particular, this applies to the splitting of a template into different transformation directions. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 In the following symmetrical Simple Transformation DEMO_ST_LOOP>>, the internal table that is bound to the ROOT> data roots and its table-like component values> are serialized and deserialized in two nested tt:loop > loops. For demonstration purposes, an alias called line> is defined in the outermost loop and is addressed in the loop using $line>. Since $line> is not addressed in the inner loop, the definition of the alias name would not be necessary here. TRNS DEMO_ST_LOOP The following ABAP program can call the transformation: ABEXA 01714 The result of the serialization is the following: < tab1> < key>2 < /key> < tab2> < value>4 < /value> < value>8 < /value> < value>16 < /value> < /tab2> < key>3 < /key> < tab2> < value>9 < /value> < value>27 < /value> < value>81 < /value> < /tab2> < key>4 < /key> < tab2> < value>16 < /value> < value>64 < /value> < value>256 < /value> < /tab2> < /tab1>> The transformation is symmetrical>. After deserialization, result> has the same content as itab>. ABAP_EXAMPLE_END