Ansicht
Dokumentation

ABAPMOVE-CORRESPONDING_ITAB - MOVE-CORRESPONDING ITAB

ABAPMOVE-CORRESPONDING_ITAB - MOVE-CORRESPONDING ITAB

Vendor Master (General Section)   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

MOVE-CORRESPONDING, itab

Short Reference



MOVE-CORRESPONDING $[EXACT$] itab1 TO itab2.
  $[EXPANDING NESTED TABLES$] $[KEEPING TARGET LINES$]
.

Additions

1. ... EXPANDING NESTED TABLES

2. ... KEEPING TARGET LINES

Effect

This variant of the statement MOVE-CORRESPONDING requires internal tables to be specified for itab1 and itab2. It searches for all identically named components in the line types of itab1 and itab2 and assigns them from itab1 to itab2 in accordance with the rules below.

  • If the line type is structured, the components are the structure components.
  • A non-structured line type is handled like a structure with a single component. The type of the component is the line type of the internal table, that is, elementary, a table itself, or a reference variable. The component has an internal name that is the same for all tables.

If there are identically named components, the target table itab2 is deleted without the addition KEEPING TARGET LINES and the same number of initial lines are inserted as exist in the source table itab1. The lines of the source table are then read sequentially in the same order as in the statement LOOP, and the content of each line is assigned to the corresponding line in the target table in accordance with the rules for MOVE-CORRESPONDING $[EXACT$] for structures. Finally, and if necessary, the table keys and associated table indexes are updated in the target table in accordance with the rules insertions in internal tables. The corresponding exceptions are raised if uniqueness is violated.

If there are no identically named components, no assignment is made and the target table remains unchanged.

Notes

  • MOVE-CORRESPONDING is always ignored when an internal table with a non-structured line type is assigned to an internal table with a structured line type and vice versa.
  • Without additions, MOVE-CORRESPONDING has the same effect on the assignment of an internal table with non-structured line 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 lines are not deleted first and then filled again.
  • The convertibility of the components, if it is known, is checked statically. If the convertibility cannot be determined statically, a runtime error is only raised if an assignment is actually performed.

Addition 1

... EXPANDING NESTED TABLES

Effect

If this addition is specified, the individual lines 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 lines 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.

Addition 2

... KEEPING TARGET LINES

Effect

This addition ensures that the target table itab2 is not deleted. Instead, it appends the same number of initial lines as exist in the source table itab1 and assigns the lines of the source table to these initial lines. The table keys and indexes are then updated across all lines. If no identically named components are found, the target table remains unchanged.

Note

The addition KEEPING TARGET LINES is only effective on the lines of itab2. It cannot be effective on nested tables, even if it is specified with the addition EXPANDING NESTED TABLES. This is because nested tables are always resolved in new initial lines.

Example

Assignment of four identically named components of standard table spfli_tab to a sorted table flights.

MOVE-CORRESPONDING for Internal Tables






Addresses (Business Address Services)   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 5937 Date: 20240416 Time: 070801     sap01-206 ( 84 ms )