In an ST program, you can call another ST program trafo as follows:
<tt:call
transformation=“trafo“>
[<tt:with-root name="root1"
[ref=”node1”]
/ >
<tt:with-root name="
root2"
[ref=”node2”]
/ >
...]
[<tt:with-parameter name="para1"
[ref=”node1”|val=”val1”|var=”var1”]
/>
<tt:with-parameter
name="para2"
[ref=”node2”|val=”val2”|var=”var2”]
/>
...]
</tt:call>
The ST program trafo must exist actively in the repository. Case distinction is of no importance in trafo.
The ST commands tt:with-root bind the data roots root1, root2, ... of the main template of the called transformation to the nodes node1, node2, ... of the current transformation or, respectively, pass to these data roots the ABAP data objects that are currently bound to the specified nodes. If refis not specified, the current node of the calling transaction is used.
If in the called ST program formal parameters are declared using tt:parameter, you can use the ST command tt:with-parameter to link them to actual parameters. As actual parameters, you can specify data roots with ref, variables with var and values with val. Depending on the kind of formal parameter, the values of the specified actual parameters are either passed in the call or copied when the called ST program ends.
In the ST program below, another ST program is called in a tt:loop.
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<tab1>
<tt:loop ref="ROOT">
<key>
<tt:value
ref="key" />
</key>
<tt:call transformation="...">
<tt:with-root name="ROOT" ref="values"/>
</tt:call>
</tt:loop>
</tab1>
</tt:template>
</tt:transform>
If the called ST program is implemented as shown below, then the transformation has the same functionality as the example of a transformation of internal tables..
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<tab2>
<tt:loop ref="ROOT">
<value>
<tt:value/>
</value>
</tt:loop>
</tab2>
</tt:template>
</tt:transform>