Start of Content Area

Syntax documentation Addressing Subnodes  Locate the document in its SAP Library structure

When addressing subnodes, you must distinguish between defined and 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 executing the transformation, 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. 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. ... .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 executing the transformation, 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. 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 you can address the data root ROOT using "ROOT".

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

 

 

End of Content Area