Show TOC

Syntax documentationAddressing Subnodes Locate this document in the navigation structure

When addressing subnodes, you must distinguish between a defined and an undefined current node.

Subnodes When the Current Node is Undefined

If the current node is undefined, you can address the subnodes of the data root of the template as follows:

"name.node1.node2. ... .noden"

Here, "name" is the symbolic name of a data root and "node1" to "noden" are the actual names of components of the hierarchy levels 1 to n. When the transformation is executed, the ABAP data object bound to the data root must have a structured type with these components.

Note Note

If the current node is undefined, the first name of a chain is always interpreted as the name of a data root. In particular, "name" is used for the data root itself.

End of the note.
Subnodes When the Current Node is Defined
  • The subnodes of the current node can be addressed in the following way:

    "node1.node2. ... .noden"

    or

    Here, "node1" to "noden" are the actual names of components of the hierarchy levels 1 to n below the current node. If the current node is defined, the first name of a chain is always interpreted as the name of a component of the current node. The chain above therefore has the same meaning as

    "$ref.node1.node2. ... .noden"

    where $ref is the current node.

  • The subnodes of the data root of the template can be addressed in the following way:

    ".name.node1.node2. ... .noden"

    Here, "name" is the symbolic name of a data root and "node1" to "noden" are the actual names of components of the hierarchy levels 1 to n. The period "." bypasses the shading by the current node.

When the transformation is executed, the ABAP data object bound to the current node or to the data root must have a structured type with these components.

Note Note

If the current node is defined, the first name of a chain is always interpreted as the name of a subcomponent of the current node. In particular, "node" does not stand for a data root, but for a direct subcomponent of the current node.

End of the note.
Example

The following ST program can be used to serialize a nested ABAP structure:

Syntax Syntax

  1. <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
  2.   <tt:root name="ROOT"/>
  3.   <tt:template>
  4.     <X>
  5.       <X1>
  6.         <tt:value ref="ROOT.COL1" />
  7.       </X1>
  8.       <X2>
  9.         <tt:value ref="ROOT.COL2" />
  10.       </X2>
  11.       <X3>
  12.         <X1>
  13.           <tt:value ref="ROOT.STRUC2.COL1" />
  14.         </X1>
  15.         <X2>
  16.           <tt:value ref="ROOT.STRUC2.COL2" />
  17.         </X2>
  18.       </X3>
  19.     </X>
  20.   </tt:template>
  21. </tt:transform>
End of the code.

For each tt:value command, the current node is set individually to a subnode of the data root. Otherwise the current node is undefined and you can address the data root ROOT using "ROOT".

Also see the example for calling a transformation in the Structures section.