MOVE-CORRESPONDING for Internal Tables

MOVE-CORRESPONDINGABAP Release 7.40 SP05 provides many different powerful features. The post describes about how to use MOVE-CORRESPONDING with respect to Internal tables.

 

 

Program


DATAlt_scarr TYPE TABLE OF scarr,
              lt_spfli TYPE TABLE OF spfli.
START-OF-SELECTION.
  SELECT FROM scarr INTO TABLE lt_scarr.
  SELECT FROM spfli INTO TABLE lt_spfli.
  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
    EXPORTING
      i_callback_program syrepid
      i_structure_name   ‘SCARR’
    TABLES
      t_outtab           lt_scarr.
  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
    EXPORTING
      i_callback_program syrepid
      i_structure_name   ‘SPFLI’
    TABLES
      t_outtab           lt_spfli.

  MOVE-CORRESPONDING lt_scarr TO lt_spfli .

  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
    EXPORTING
      i_callback_program syrepid
      i_structure_name   ‘SPFLI’
    TABLES
      t_outtab           lt_spfli.


1

ALV for SCARR table.

2

ALV for SPFLI table.

3

MOVE-CORRESPONDING lt_scarr TO lt_spfli . This statement just deletes the entries from the target table and moves the matching fields from source to the target .

ALV for SPFLI table after  MOVE-CORRESPONDING lt_scarr TO lt_spfli .

4


 

DATAlt_scarr TYPE TABLE OF scarr,
              lt_spfli TYPE TABLE OF spfli.
START-OF-SELECTION.
  SELECT FROM scarr INTO TABLE lt_scarr.
  SELECT FROM spfli INTO TABLE lt_spfli.
  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
    EXPORTING
      i_callback_program syrepid
      i_structure_name   ‘SCARR’
    TABLES
      t_outtab           lt_scarr.
  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
    EXPORTING
      i_callback_program syrepid
      i_structure_name   ‘SPFLI’
    TABLES
      t_outtab           lt_spfli.

  MOVE-CORRESPONDING lt_scarr TO lt_spfli KEEPING TARGET LINES.

  CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
    EXPORTING
      i_callback_program syrepid
      i_structure_name   ‘SPFLI’
    TABLES
      t_outtab           lt_spfli.

This statement  MOVE-CORRESPONDING lt_scarr TO lt_spfli KEEPING TARGET LINES. just append records from the source table to the target table with matching fields without deleting the target table entries.

5

ALV for SPFLI table after  

MOVE-CORRESPONDING lt_scarr TO lt_spfli KEEPING TARGET LINES.

6


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s