Get Example source ABAP code based on a different SAP table
Adjusted Serialization and Deserialization This example demonstrates the adjusted serialization and deserialization of objects.
ABAP_SOURCE_CODE DEMO CL_DEMO_SERIALIZABLE_OBJECT
ABAP_DESCRIPTION Using the identity transformation> ID> , objects in two classes are serialized to asXML > and to asJSON> , and then deserialized. The object of the class cl_unsafe> is processed by default. The example shows that the standard behavior allows an object in a class to be created for which a private attribute receives a value set from outside, both for asXML and for asJSON After deserialization, the value of the private attribute attr> in the new class does not match the value defined in the class. The object of the class cl_safe> is processed in an adjusted way. The example shows demonstrates how the methods SERIALIZE_HELPER> and DESERIALIZE_HELPER> can be used to prevent unwanted manipulation of attributes. The private attribute attr> is serialized using SERIALIZE_HELPER> but is not deserialized in DESERIALIZE_HELPER>.