Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Data Interfaces and Communication Interfaces →  ABAP and XML →  Transformations for XML →  ST - Simple Transformations →  ST - Addressing ABAP Data →  ST - Addressing Data Nodes 

ST - Addressing Subnodes

When addressing subnodes, it is important to distinguish between a defined and undefined current node.

Other versions: 7.31 | 7.40 | 7.54

Subnodes When the Current Node is Undefined

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

name.node1.node2. ...

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


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.

Subnodes When the Current Node is Defined

  • The subnodes of the current node can be addressed in the following way:
node1.node2. ...
Here, node1, node2, ... are the actual names of components of the hierarchy levels 1, 2, ... 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. ...
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. ...
Here, name is the symbolic name of a data root and node1, node2, ... are the actual names of components of the hierarchy levels 1, 3.... The period (.) bypasses the obscuring of the root 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

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.


Example

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

<tt:transform
  xmlns:tt="http://www.sap.com/transformation-templates">
  <tt:root name="ROOT"/>
  <tt:template>
    <X>
      <X1>
        <tt:value ref="ROOT.COL1" />
      </X1>
      <X2>
        <tt:value ref="ROOT.COL2" />
      </X2>
      <X3>
        <X1>
          <tt:value ref="ROOT.STRUC2.COL1" />
        </X1>
        <X2>
          <tt:value ref="ROOT.STRUC2.COL2" />
        </X2>
      </X3>
    </X>
  </tt:template>
</tt:transform>

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 the data root ROOT can be addressed using its name. Also see the example for calling a transformation in the tt:value, Structures section.