SAP CORRESPONDING DEEP MAPP ABEXA



Get Example source ABAP code based on a different SAP table
  



Component Operator, Nested Mapping Rule
This example demonstrates the component operator with a nested mapping rule.

ABAP_SOURCE_CODE
DEMO CL_DEMO_CRRSPNDNG_DEEP_MAPP

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. The structures contain a substructure and a tabular component.
If there is not mapping rule, the identically named components a2 and istruct are assigned at the top level. The substructure istruct is resolved and the component a2 is assigned here. The tabular components are not identically named and are not assigned.
The mapping rule MAPPING jtab = itab is also used to assign the tabular component, whereby only the identically named column a2 is considered.
The nested mapping rule MAPPING ( istruct = istruct MAPPING b1 = a1 EXCEPT a2 )
( jtab = itab MAPPING b1 = a1 ) is used to
specify a mapping relationship for the components of the substructure istruct. Here, istruct = istruct must be specified at the top level.
define a mapping for the tabular components. Here, a mapping is also nested for their columns. In the result, all components are filled except the component a2 of the substructure that was excluded using EXCEPT.