Get Example source ABAP code based on a different SAP table
Serializing Data References This example demonstrates serializations of data references to asXML> and to asJSON>.
ABAP_SOURCE_CODE DEMO CL_DEMO_SERIALIZE_DREF
ABAP_DESCRIPTION This example demonstrates the serialization of data reference variables using the identity transformation> ID> to the canonical formats asXML> and asJSON>.
First a data reference is serialized that points to an anonymous data object in the heap and whose dynamic type struc> was created in the same method using the TYPES> statement. No problems should arise from this serialization.
Next, however, a data reference variable is serialized that points to an anonymous data object in the heap whose dynamic type does not have a name. This is the technical type of a structure and reference to this type is made using LIKE>. A data reference variable of this type cannot be serialized without taking further actions. This exception can be prevented using the transformation option technical_types>>, however the data reference variable is ignored.
Finally, a data reference variable is serialized that points to a data object in the stack. The data reference variable is ignored by default, but can be serialized using the transformation option data_refs>>.