Skip to content

MOVE-CORRESPONDING and performance

A thing that many ABAP programmers may have heard early in their career is to avoid "MOVE-CORRESPONDING" because it performes badly. The aspiring programmers then are quickly told to only move the field of the structure they need. This can become tedious and prone to error quickly. But sometimes one have to make sacrifices during design/developement time, to save execution time.

I don't know if the performance hit of MOVE-CORRESPONDING has ever been true, (perhaps in ancient releases) but according to some tests Ashok Kumar Rajagopal ran and published on the SCN a program using MOVE-CORRESPONDING does not only performe on par with "manual" moves, but actually performes better.

So, in my opinion, there is no reason left to not use MOVE-CORRESPONDING. It looks nicer, is less work to type and actually performes better.


In light of recent events: There is a small caveat to the "FOR ALL ENTRIES IN itab WHERE"-clause. This is an incredibly useful addition to the where condition when you need to do selects based on the content of an internal table. But the trap is, that if your itab is empty the SELECT returns all rows, instead of nothing. This is actually well documented behaviour, still a lot of developers fall into this trap.

Your code should look more like this:

  SELECT col1, col2
  FROM dtab
  INTO TABLE target
WHERE colx = itab-eval.
"handle empty itab if necessary

You can omit the else clause depending on your code.

MOVE-CORRESPONDING itab1 TO itab2 in ABAP 7.40 SP05

Today Horst Keller published a new blog entry ABAP Language News for Release 7.40, SP05. I began to read it and immidiately my jaw almost dropped to the ground. With ABAP 7.40 SP05 SAP finally implemented the long-awaited MOVE-CORRESPONDING for internal tables.

So instead of the tedious

LOOP AT itab1 ASSIGNING <itab>.
MOVE-CORRESPONDING <itab> TO ls_itab2.
APPEND ls_itab2 TO itab2.

you can now write


For more information (especially on the additional keywords) you can check the official documentation. You should also read the original post because there got a lot of other features added with SP05.

ABAP 7.40

Horst Keller, writer of the ABAP Docs, wrote a series of posts about the new features of ABAP 7.40, which is a huge step in modernizing the language. For me the - at the moment - most interesting new features are the CONV & CAST Operators and the Inline Declarations. I think both are features we long sought after. With CONV you no longer need a helper variable to use c-typed variable as a string-typed method parameter. With CAST you can get rid of intermediate assignments when working with objects and functional method calls. Inline Declarations spare you, amongst other things, the seperat declarion of work areas (even as field symbols).
Every ABAP developer, even if you are still years from upgrading, should take a look at the whole list.

ABAP 7.40 ships with SAP Netweaver 7.40.