SAP CL ABAP CORR STRUC ABEXA



Get Example source ABAP code based on a different SAP table
  



CL_ABAP_CORRESPONDING for Nested Structures
This example demonstrates the system class CL_ABAP_CORRESPONDING for nested structures.

ABAP_SOURCE_CODE
DEMO CL_DEMO_CRRSPNDNG_CLASS_STR

ABAP_DESCRIPTION
The components of the structure struct1 are assigned to the structure struct2 using the system class CL_ABAP_CORRESPONDING.
At the top level:
a1 is mapped to b3 and a3 is mapped to b1.
a2 to b2 are ignored, since their names do not match and b2 keeps their value.
The component a4 occurs in both structures and is assigned using identical names.
a5 also occurs in both structures but is excluded explicitly by the mapping type.
The substructure asub1 is mapped to the substructure bsub1 .
At the level of the first substructure:
s1_a1 is mapped to s1_b3 and s1_a3 is mapped to s1_b1.
s1_a2 to s1_b2 are ignored, since their names are not identical and s1_b2 keeps their value.
The substructure asub2 is mapped to the substructure bsub2 .
At the level of the second substructure:
s2_a1 is mapped to s2_b3 and s2_a3 is mapped to s2_b1.
s2_a2 to s2_b2 are ignored, since their names are not identical and s2_b2 keeps their value.