MOVE-CORRESPONDING - itab
Short Reference
This variant is not yet released and cannot be used.
ABAP Syntax MOVE-CORRESPONDING [EXACT] itab1 TO itab2.
[EXPANDING NESTED TABLES] [KEEPING TARGET LINES] .
ABAP_ADDITIONS:
1 ... EXPANDING NESTED TABLES
2 ... KEEPING TARGET LINES
What does it do? This variant of the statement MOVE-CORRESPONDING
requires internal tables to be
specified for itab1 and itab2 . It searches for all
similarly named components in the row types of itab1 and
itab2 and assigns them from itab1 to itab2 in
accordance with the rules below.
If the row type is structured, the components are the structure
components.
A non-structured row type is handled like a structure with a single
component. The type of the component is the row type of the internal
table (elementary), is a table itself, or is a reference variable. The
component has an internal name that is the same for all tables.
If there are components with the same name, the target table itab2
is deleted without the addition KEEPING TARGET LINES and the
same number of initial rows are inserted as exist in the source table
itab1 . The rows of the source table are then extracted
sequentially (in the same order as in the statement
LOOP ) and the content of each row is
assigned to the corresponding row in the target table in accordance with
the rules for
MOVE-CORRESPONDING [EXACT] for structures . Finally, the
table keys and associated
table indexes are updated (if necessary)
in the target table in accordance with the rules
insertions in internal tables . The relevant exceptions are raised if
uniqueness is violated.
If there are no components with the same name, no assignment is made
and the target table is left unchanged.
Latest notes: MOVE-CORRESPONDING never has an effect when an
internal table with a non-structured row type is assigned to an internal
table with a structured row type.
Without additions, MOVE-CORRESPONDING has the same effect on
the assignment of an internal table with non-structured row type to a
similar table as a regular assignment .
If an internal table, itab , is assigned to itself using
MOVE-CORRESPONDING , the statement is ignored. This also means that
the rows are not deleted first and then filled again.
ABAP_ADDITION_1 ... EXPANDING NESTED TABLES
What does it do? If this addition is specified, the individual rows are
assigned in accordance with the rules for
MOVE-CORRESPONDING [EXACT]
with EXPANDING NESTED TABLES specified, and tabular
components are resolved at every hierarchy level.
If the addition is not specified, the individual rows are assigned in
accordance with the rules for
MOVE-CORRESPONDING [EXACT] without EXPANDING NESTED TABLES
specified, and tabular components are assigned in accordance with the
rules for assignments or
lossless assignments .
ABAP_ADDITION_2 ... KEEPING TARGET LINES
What does it do? This addition stops the target table itab2 from
being deleted. Instead, it appends the same number of initial rows as
exist in the source table itab1 . The rows of the source tables
are then mapped to these rows. The table keys and indexes are then
updated across all rows. If no identically named components are found,
the target table remains unchanged.
Latest notes: The addition KEEPING TARGET LINES is only effective
on the rows of itab2 . It cannot be effective on nested tables,
even when specified with the addition EXPANDING NESTED TABLES .
This is because nested tables are always resolved in new initial rows.
Example ABAP Coding See
MOVE-CORRESPONDING for internal tables .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved