SAP ST TT ASSIGN



Get Example source ABAP code based on a different SAP table
  


• assign ABAP_ST_ELEMENT

ABAP_ST - tt:assign, Value Assignment

ABAP_SYNTAX
< tt:assign $[to-ref='node'$|to-var='variable'$]
$[ref='node'$|val='value'$|var='variable'$] />

What does it do?
The statement tt:assign is used to assign a value to a data root, a variable, or a parameter.
to-ref or to-var is used to specify the target field, and ref, val, or var to specify the source field. If no target field or no source field is specified, the current node is used implicitly. Target and source fields can be:
a node node specified in accordance with the addressing rules,
a variable or a parameter variable,
a value value specified in accordance with the rules for ABAP values (source field only)
An assignment between reference variables with tt:assign is possible only if the static type of the source variables is more specific or the same as the static type of the target variables (upcast). In all other cases, the tt:cast statement can be used to perform a downcast.

Serialization
In serializations, only variables (or parameters) are given the current value of the source field. If a data node is specified as the target field using to-ref or if the current node is specified implicitly, tt:assign is ignored in serializations.

Deserialization
In deserializations, only variables (or parameters) or directly specified values are evaluated as source fields. If a node is specified as the source field (using ref) or if the current node is specified implicitly, tt:assign is ignored in deserializations.
The following syntax can be used if the current node, or the node specified after to-ref, is an internal table:
< tt:assign $[to-ref='itab'$]>
< tt:assign $[to-ref='comp'$]
$[val='value'$|var='variable'$] />
...
< /tt:assign>
A line is then inserted into the internal table specified. The values of the components are set using the inner statements tt:assign. This statement is ignored in serializations.

ABAP_EXAMPLE_VX5
The transformation DEMO_ST_ASSIGN below shows value assignments:
TRNS DEMO_ST_ASSIGN
During a deserialization, the value 22 is assigned to the ABAP data object bound to the data root ROOT.
ABAP_EXAMPLE_END