ABAP - Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Assignments →  Assigning Structure Components →  CORRESPONDING - Component Operator → 



... [ MAPPING {t1 = s1}|( t1 = s1 [MAPPING ...] [EXCEPT ...] )
              {t2 = s2}|( t2 = s2 [MAPPING ...] [EXCEPT ...] )
              ...  ]
    [ EXCEPT {ti tj ...}|* ] ...


1. ... MAPPING  t1 = s1 t2 = s2 ...

2. ... EXCEPT  {t1 t2 ...}|*


Mapping rule for the component operator CORRESPONDING. The optional mapping rule overrides the default assignment of identically named components only. The additions MAPPING and EXCEPT can be used individually or together. EXCEPT must always be specified after MAPPING.


Addition 1

... MAPPING  t1 = s1 t2 = s2 ...


After MAPPING, t1, t2, ... are used to assign the components s1, s2,... of a source structure or source table in mapping relationships to the components of a target structure or target table.

If the components specified on the left and right of an equals sign of a mapping relationship are themselves structured or tabular with a structured row type, a separate mapping rule can be nested for these components. Here, the mapping relationship is set in parentheses ( ... ) and a further mapping rule MAPPING ... and/or EXCEPT ... is specified after the mapping relationship in accordance with the same rules as on the top level. The parentheses are not allowed if a nested mapping rule is not used.

A component of a target object cannot appear more than once in a list after MAPPING and the structure component selector cannot be used to access subcomponents. Neither of these rules apply to components of the source object. If MAPPING is used, the table types involved must also have structured row types in the basic form and the addition DEEP is set implicitly.

The content of the component specified on the right side of an equals sign in a mapping relationship is assigned to each component specified on the left side. If there is an identically named component in the target structure for a component specified on the right side, it is also assigned content (unless it is specified on the left side of a mapping relationship itself). In elementary components the assignment is made in accordance with the associated assignment rules. In structured and tabular components, the assignment is made in accordance with the rules of MOVE-CORRESPONDING with the addition EXPANDING NESTED TABLES.

Identically named components can also be specified on the right and left side of the equals sign. This is a good idea in the following cases:


The pseudo component table_line cannot be specified as a component of an internal table in the mapping rule.

Addition 2

... EXCEPT  {t1 t2 ...}|*


After EXCEPT, components t1, t2, ... of the target structure or target table that are not specified in a preceding mapping relationship or an asterisk, *, can be specified:

Access to subcomponents of components of the target object using the structure component selector is not allowed in the list after EXCEPT either.



Assigns the components of the structure struct1 to the components of the structure struct2 using mapping rules for the components at the top level and the components of the substructure.

DATA: BEGIN OF struct1,
        mcomp1 TYPE i VALUE 1,
        mcomp2 TYPE i VALUE 2,
        BEGIN OF substruc,
          subcomp1 TYPE i VALUE 1,
          subcomp2 TYPE i VALUE 2,
          subcomp3 TYPE i VALUE 3,
        END OF substruc,
      END OF struct1.

DATA: BEGIN OF struct2,
        comp2 TYPE i,
        comp1 TYPE i,
        BEGIN OF substruc,
          comp3 TYPE i,
          comp2 TYPE i,
          comp1 TYPE i,
        END OF substruc,
      END OF struct2.

struct2 =
    struct1 MAPPING comp1    = mcomp1
                    comp2    = mcomp2
                  ( substruc = substruc MAPPING comp1 = subcomp1
                                                comp2 = subcomp2
                                                comp3 = subcomp3 ) ) .