MOVE-CORRESPONDING struc1 TO struc2.
Structures must be specified for struc1 and struc2. All components with the same name are searched for in struc1 und struc2 and the content of components in struc1 is assigned to the components with the same name in struc2. All other components are not affected.
Nested structures are fully expanded. The names of the components are compared to the lowest common level. For each comp component pair with the same name, the
MOVE struc1-comp TO struc2-comp.
statement is executed, and - if necessary - the corresponding conversions are performed.
Before Release 6.10, specified field symbols or formal parameters had to be structured and typed for
struc1 and struc2.
Since Release 6.10 untyped field symbols, field symbols with the generic type
ANY, or formal parameters can be used for struc1
and struc2. These must be structures when the statement is executed, otherwise an untreatable exception is triggered.
If structures are specified for struc1 and
struc2, the name is compared once when the program is generated by the ABAP Compiler. If
untyped field symbols or formal parameters are used, the names must be compared each time the statement is executed.
The structure struc1 contains the components:
The structure struc2 contains the components:
Over the length of the shorter path, the components struci-comp1 and struci-comp2 have the same name. These are assigned from struc1 to struc2. In struc1, struci-comp2 is self-structured, in struc2, struci-comp2 is elementary. In the assignment of struc1-struci-comp2 to struc2-struci-comp2, the source field is documented as an elementary field of type c in accordance with the conversion rules for structures. The components struc1-comp1 and struc2-struci-comp3 do not have any equivalents with the same name and are not taken into account in the assignment.
DATA: BEGIN OF struc1,
comp TYPE c LENGTH 1 VALUE 'U',
BEGIN OF struci,
comp1 TYPE c LENGTH 1 VALUE 'V',
BEGIN OF comp2,
col1 TYPE c LENGTH 1 VALUE 'X',
col2 TYPE c LENGTH 1 VALUE 'Y',
END OF comp2,
END OF struci,
END OF struc1.
DATA: BEGIN OF struc2,
BEGIN OF struci,
comp1 TYPE string,
comp2 TYPE string,
comp3 TYPE string,
END OF struci,
END OF struc2.
MOVE-CORRESPONDING struc1 TO struc2.
Non-Catchable Exceptions