SAP ABAP Syntax MOVE-CORRESPONDING
ABAP Syntax No Comments »Syntax
MOVE-CORRESPONDING struc1 TO struc2.
Effect
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.
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.
Recent Comments