SAP CORRESPONDING MAPPING ABEXA



Get Example source ABAP code based on a different SAP table
  



Component Operator, Mapping Rule
This example demonstrates the component operator with explicit mapping rules.

ABAP_SOURCE_CODE
DEMO CL_DEMO_CRRSPNDNG_MAPPING

ABAP_DESCRIPTION
The example assigns the basic form of the result of a constructor expression with the component operator CORRESPONDING with the parameter struct1 to a compatible structure struct2. Various mapping rules are demonstrated.
If no mapping rule is used, the identically named components a1 and a2 are assigned and the other components remain initial.
The mapping rule MAPPING b4 = a3 also assigns the component a3 to the component b4.
The mapping rule MAPPING b4 = a1 assigns the component a1 twice, to b4 and to the identically named component a1.
The mapping rule EXCEPT a1 assigns only the component a2 to the identically named component, since the component a1 is excluded.
In addition to the identically named assignment, the mapping rule MAPPING b4 = a3 EXCEPT a1 assigns the component a3 to the component b4 and a1 is excluded from the identically named assignment.
The mapping rule EXCEPT * does not assign any components and all components of the result remain initial.