Skip to Content
Author's profile photo Florian Martin

Unexpected performance finding with MOVE-CORRESPONDING between table and structure variant

During some tests with a huge amount of data a a colleague of me Dirk Freundel gets unexpected performance finding between:

  1. MOVE-CORRESPONDING struc1 TO struc2
  2. MOVE-CORRESPONDING itab1 TO itab2

He put 1.000.000 lines of a table with 27 columns into a internal table with 16 columns. Variant 1 needed about 179 ms less time than variant 2.

Test code:


*   Init
    FREE lt_middle.

*   Runtime
    GET RUN TIME FIELD lv_runtime_a.

*   LOOP
    LOOP AT lt_database ASSIGNING <fs_database>.   

        MOVE-CORRESPONDING <fs_database> TO ls_middle.     
        INSERT ls_middle INTO TABLE lt_middle.


    "MOVE-CORRESPONDING lt_database TO lt_middle.

*   Runtime
    GET RUN TIME FIELD lv_runtime_b.
    lv_runtime_b = ( lv_runtime_b - lv_runtime_a ) / 1000.
    WRITE: / SY-INDEX, ' Runtime [msec]: ', lv_runtime_b.


Has anybody else observed the same performance finding, Please add a comment.


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Eyann Zen
      Eyann Zen

      Hi Florian .Your code kind of confuses me .To me itab1 itab2 struc1 struc2 are the same things .They are all work area. Maybe it's coincidence ??^^

      Author's profile photo Former Member
      Former Member

      Hi Eyann,


      I came to this when I had the requirement to copy data from itab1 (lt_database) to itab2 (lt_middle). lt_database has 27 fields, lt_middle just has 16 fields. So there are two possibilities:

      • LOOP AT lt_database an use MOVE-CORRESPONDING ls_database ("struc1") TO ls_middle ("struc2")
      • MOVE-CORRESPONDING lt_database ("itab1") TO lt_middle ("itab2")

      I think the "MOVE-CORRESPONDING itab1 TO itab2" is a rather new ABAP command, while "MOVE-CORRESPONDING struc1 TO struc2" is very old - so I thought/ hoped that the new command has performance advantages over the old LOOP & MOVE...