MOVE-CORRESPONDING for internal tables ABAP 7.4


Now MOVE-CORRESPONDING can be used with internal tables, with additions EXPANDING NESTED TABLES KEEPING TARGET LINES

A+ A-

You can use MOVE-CORRESPONDING not only for structures but also for internal tables, if you use this components of the same name will be assigned row by row, newly added keywords EXPANDING NESTED TABLES and KEEPING TARGET LINES will allow to add some conditions like appending lines instead of overwriting.

Syntax: MOVE-CORRESPONDING <ITAB1> to <ITAB2> EXPANDING NESTED TABLES     KEEPING TARGET LINES. 
** EXPANDING NESTED TABLES and KEEPING TARGET LINES are optional

Example program to demonstrate using MOVE-CORRESPONDING with internal tables

SELECT * FROM
  MARA INTO TABLE @DATA(it_mara)
  UP To 10 ROWS
  where mtart = 'FERT' .

SELECT * FROM
MARA INTO TABLE @DATA(it_mara1)
UP To 5 ROWS
where mtart = 'FERT' .

MOVE-CORRESPONDING it_mara to it_mara1.
ULINE.
WRITE:/ 'MOVE-CORRESPONDING'.
ULINE.
LOOP AT it_mara1 INTO DATA(wa_mara).
  WRITE:/ wa_mara-matnr, wa_mara-mtart.
ENDLOOP.

MOVE-CORRESPONDING it_mara to it_mara1 EXPANDING NESTED TABLES
                                       .
ULINE.
MOVE-CORRESPONDING it_mara to it_mara1.
ULINE.
WRITE:/ 'MOVE-CORRESPONDING .. EXPANDING NESTED TABLES'.
ULINE.
LOOP AT it_mara1 INTO wa_mara.
  WRITE:/ wa_mara-matnr, wa_mara-mtart.
ENDLOOP.

MOVE-CORRESPONDING it_mara to it_mara1 EXPANDING NESTED TABLES
                                       KEEPING TARGET LINES.
ULINE.

WRITE:/ 'MOVE-CORRESPONDING .. EXPANDING NESTED TABLES KEEPING TARGET LINES'.
ULINE.
LOOP AT it_mara1 INTO wa_mara.
  WRITE:/ wa_mara-matnr, wa_mara-mtart.
ENDLOOP.

MOVE-CORRESPONDING internal tables


Learner Questions

No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question


    Was this lesson helpful to you? Yes No 1 People out of 1 think this lesson helpful

    Lesson Navigation

    ←Previous Chapter
    Next Chapter →