struci-comp1
, struci-comp2 , and itab have the same name. These are
assigned from struc1 to struc2 in both
MOVE-CORRESPONDING statements. In struc1 , struci-comp2
is self-structured; in struc2 , struci-comp2 is elementary.
When struc1-struci-comp2 is assigned 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 itab are table-like and have compatible row
types. The statement MOVE-CORRESPONDING without the addition
EXPANDING NESTED TABLE maps the table body and the content of
itab in struc2 then matches the content of itab in
struc1 . If the addition EXPANDING NESTED TABLE is used, only
the component col2 is mapped and col3 remains initial.
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 line1,
col1 TYPE i,
col2 TYPE i,
END OF line1,
BEGIN OF line2,
col2 TYPE i,
col3 TYPE i,
END OF line2.
DATA: BEGIN OF struc1,
comp1 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,
itab LIKE TABLE OF line1,
END OF struc1.
DATA: BEGIN OF struc2,
BEGIN OF struci,
comp1 TYPE string,
comp2 TYPE string,
comp3 TYPE string,
END OF struci,
itab LIKE TABLE OF line2,
END OF struc2.
line1-col1 = 11. line1-col2 = 12.
APPEND line1 TO struc1-itab.
line1-col1 = 21. line1-col2 = 22.
APPEND line1 TO struc1-itab.
MOVE-CORRESPONDING struc1 TO struc2.
*MOVE-CORRESPONDING struc1 TO struc2 EXPANDING NESTED TABLES.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved