SAP ST TT COPY



Get Example source ABAP code based on a different SAP table
  


• copy ABAP_ST_ELEMENT

ABAP_ST - tt:copy, asXML Format

ABAP_SYNTAX
< tt:copy $[ref='node'$] />

What does it do?
Statement tt:copy is used to serialize in and deserialize from the asXML format. It can be used on all data objects with the exception of reference variables or objects containing reference variables as components.
The optional attribute ref can be used to define the current node for the statement. If ref is not specified, the current node of the surrounding element is used implicitly.

Serialization
In serializations, the entire ABAP data object that is bound to the current node is recursively transformed with all its components to asXML format and inserted into the XML data in place of the statement.

Deserialization
In deserializations, the XML data stream is interpreted as asXML format and its values are passed to the ABAP data object that is bound to the current node.



Latest notes:

In serializations of data objects using tt:copy, it is important to note that a node will not be automatically inserted for the asXML format created. To get valid XML data, the node must be explicitly specified in the template. If not, the XML data cannot be deserialized. The only exceptions are structures with a single component or internal tables with a single line. However, these do not generally have any practical use.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The following Simple Transformation DEMO_ST_COPY serializes the ABAP data object that is bound to data root ROOT under the node < node> into the asXML format. If the node < node> is not specified, the transformation would not produce valid XML data and deserialization would raise an exception.
TRNS DEMO_ST_COPY
When the ABAP program from the example in section Internal Tables calls this transformation, the serialization process has the following result: < node>
< item>
< KEY>2 < /KEY>
< VALUES>
< item>4 < /item>
< item>8 < /item>
< item>16 < /item>
< /VALUES>
< /item>
< item>
< KEY>3 < /KEY>
< VALUES>
< item>9 < /item>
< item>27 < /item>
< item>81 < /item>
< /VALUES>
< /item>
< item>
< KEY>4 < /KEY>
< VALUES>
< item>16 < /item>
< item>64 < /item>
< item>256 < /item>
< /VALUES>
< /item>
< /node>
The Simple Transformation is symmetrical.
ABAP_EXAMPLE_END