We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
MOVE-CORRESPONDING $[EXACT$] struc1 TO struc2
$[EXPANDING NESTED TABLES$] $[KEEPING TARGET LINES$].
1. ... EXACT
2. ... EXPANDING NESTED TABLES
3. ... KEEPING TARGET LINES
4. ... EXPANDING NESTED TABLES KEEPING TARGET LINES
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:
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
customizing includes when the statement is executed (that is they do not contain any components),
the statement is ignored. If struc1 is a structure that contains empty customizing includes as components, these are also ignored when the structure is evaluated.
... EXACT
If the addition EXACT is specified for MOVE-CORRESPONDING, the following lossless assignment is performed for each identically named component pair comp
struc2-comp = EXACT #( struc1-comp ).
and the corresponding checks are performed. If an exception is raised, all components are assigned up to the component that raised the exception. This component, and all following components, are not assigned.
... EXPANDING NESTED TABLES
With this addition, two identically named components, that are both internal tables, are not simply assigned. Instead, for these components, the statement MOVE-CORRESPONDING $[EXACT$] for internal tables with the addition EXPANDING NESTED TABLES and without the addition KEEPING TARGET LINES is executed.
Tabular components are resolved at every hierarchy level and identically named components are assigned line by line. The target tables are deleted before an assignment.
If one of two identically named components is an internal table and the other is not, MOVE-CORRESPONDING is never possible, regardless of whether EXPANDING NESTED TABLES is used.
... KEEPING TARGET LINES
This addition affects two identically named components that are both internal tables. It ensures that the nested target tables in struc2 are not deleted. Furthermore, it appends the lines of the nested source tables in struc1 by executing the statement MOVE-CORRESPONDING [EXACT] for internal tables without an addition.
The entire table bodies of the nested source tables are assigned in accordance with the conversion rules for internal tables.
... EXPANDING NESTED TABLES KEEPING TARGET LINES
This addition affects two identically named components that are both internal tables. It ensures that
the nested target tables in struc2 are not deleted. Furthermore, it appends the lines of the
nested source tables in struc1 by executing the statement MOVE-CORRESPONDING [EXACT] EXPANDING NESTED TABLES for internal tables without an addition.
In the following example, the structure struc1 contains the components:
The structure struc2 contains the components:
Over the length of the shorter path, the components 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 interpreted as an elementary field of type c in accordance with the conversion rules for structures.
The components itab are table-like and have compatible line types. The statement MOVE-CORRESPONDING without the addition EXPANDING NESTED TABLE is used to assign 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 assigned and col3 remains initial.
The components struc1-comp1 and struc2-struci-comp3 do not have any equivalents with the same name and are ignored in the assignment.
This example shows how MOVE-CORRESPONDING is applied to two structures with the same type t_str and which are cast using field symbols with different types. The statement evaluates the names of the types of the field symbols, whereby the content of components that actually have different names are assigned.
This example shows how MOVE-CORRESPONDING is applied to two structures with the same type t_str
and which are cast using field symbols with different types. The statement evaluates the names of the
types of the field symbols, whereby the content of components that actually have different names are assigned.
Leave us your contact details and we will call you back. Fields marked with * are mandatory.
We offer holistic SAP solutions from a single source to shape digital change and develop new business areas.
Switzerland
Schaffhausen
Germany
Mannheim, Düsseldorf, Munich
USA
Haverhill
Greece
Thessaloniki