SAP MOVE-CORRESPONDING ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID MOVE-CORRESPONDING
• MOVE-CORRESPONDING ABAP Statement
• TO MOVE-CORRESPONDING
• EXACT MOVE-CORRESPONDING
• EXPANDING NESTED TABLES MOVE-CORRESPONDING
• KEEPING TARGET LINES MOVE-CORRESPONDING

MOVE-CORRESPONDING
Short Reference

ABAP_SYNTAX_FORMS

Variant for Structures
1 MOVE-CORRESPONDING $[EXACT$] struc1 TO struc2
$[EXPANDING NESTED TABLES$] $[KEEPING TARGET LINES$].

Variant for Internal Tables
2 MOVE-CORRESPONDING $[EXACT$] itab1 TO itab2
$[EXPANDING NESTED TABLES$] $[KEEPING TARGET LINES$].

ABAP_VARIANTS:
1 MOVE-CORRESPONDING struc1 TO struc2.
2 MOVE-CORRESPONDING itab1 TO itab2.

ABAP Addition
1 ... EXACT
2 ... EXPANDING NESTED TABLES
3 ... KEEPING TARGET LINES

What does it do?
The statement MOVE-CORRESPONDING is used to assign identically named components of structured data objects to each other. There are two variants of the statements:
Both operands are structures.
Both operands are internal tables.
No other combinations of operand types are possible. Field symbols typed with the generic type ANY or formal parameters can also be used as operands. An operand of this type must be either a structure or an internal table when the statement is executed and match the other operands, otherwise an uncatchable exception is raised. struc1 and itab1 are functional operand positions.
See the RAP-related variant here: to do ...



Latest notes:

If mapping based on identical names is not sufficient for the statement MOVE-CORRESPONDING, the component operator CORRESPONDING can be used, which makes it possible to define separate mapping rules statically.
If dynamic mapping rules are needed, the system class CL_ABAP_CORRESPONDING can be used.
If an internal table with a header line is specified for one of the operands, the header line is used as an operand in accordance with its data type and not the table body.
NON_V5_HINTS
ABAP_HINT_END

ABAP_VARIANT_1 MOVE-CORRESPONDING struc1 TO struc2.

What does it do?
This variant of the statement MOVE-CORRESPONDING requires structures to be specified for struc1 and struc2. As operands of the statement MOVE-CORRESPONDING, meshes are handled like regular structures and can also be specified.
The system searches for all identically named components in struc1 and struc2 and the content of components in struc1 is assigned to the identically named components in struc2. Other components are not affected. If field symbols are used as operands, the names of the components are evaluated in accordance with the data type of the field symbols, which can be distinguished by casting the names of the actual structures.
Nested structures are fully resolved. The names of the components are compared down to the lowest common level. If the addition EXPANDING NESTED TABLES is not specified, the following statement is executed identically for each named component pair comp:
struc2-comp = struc1-comp.
Any associated conversions are performed, and the corresponding exceptions may be raised. In particular, if the components are table-like, the entire table body is assigned in accordance with the conversion rules for internal tables .
If struc1 or struc2 are empty