Use the statement tt:assign to assign a value to a data root, a variable or to a parameter:
<tt:assign
[to-ref="node"|to-var="variable"]
[ref="node"|val="value"|var="variable"]
/>
Use to-ref or to-varto specify the target field, and ref, val or varfor the source field. If no target or no source field is specified, then implicitly the current node is used. Target and source fields can be:
● a node node specified according to the addressing rules
● a variable or a parameter variable
● a value value specified according to the rules for ABAP values (source field only)
During serialization, only variables (or parameters) are supplied with the current value of the source field. If as the target field a data node is specified with to-ref or if implicitly the current node is specified, then tt:assign has no effect during serialization.
During deserialization, only variables (or parameters) or directly specified values are evaluated as source fields. If as the source field a node is specified with ref or if implicitly the current node is specified, then tt:assign has no effect during deserialization.
The transformation below shows value assignments:
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root
name="ROOT"/>
<tt:variable name="VARI"
val="11"/>
<tt:parameter name="PARA"
val="22"/>
<tt:template>
<tt:assign to-var="VARI"
var="PARA"/>
<tt:assign to-ref="ROOT"
var="VARI"/>
</tt:template>
</tt:transform>
During a deserialization, the value 22 is assigned to the ABAP data object bound to the data root ROOT.