Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

performance issues due to FOR ALL ENTRIES

Hi,

I had the following select query in my code: -

SELECT vbeln posnr FROM vbup

INTO TABLE lt_del_item

FOR ALL ENTRIES IN lt_del_nos

WHERE vbeln = lt_del_nos-vbeln

AND wbsta NE gc_goods_mvmt_stat_comp

AND pdsta NE gc_pod_complete.

The above query was taking up a lot of execution time which I thought was because the 'lt_del_nos' table has about 800+ records.

In order to optimize my code, I replaced the query above with the one below: -

LOOP AT lt_del_nos INTO ls_del_header.

ls_vbeln-low = ls_del_header-vbeln.

ls_vbeln-sign = gc_inclusive_sign.

ls_vbeln-option = gc_equal_option.

APPEND ls_vbeln TO lr_vbeln.

CLEAR ls_del_header.

CLEAR ls_vbeln.

ENDLOOP.

SELECT vbeln posnr FROM vbup

INTO TABLE lt_del_item

WHERE vbeln IN lr_vbeln

AND wbsta NE gc_goods_mvmt_stat_comp

AND pdsta NE gc_pod_complete.

I found that the execution time improved significantly.

Why did the performance improve? After all the table lt_del_item and the range lr_vbeln have the same number of records. Is there any difference in the manner the the first query and the second query work?

Thanks in advance,

Divyaman

Not what you were looking for? View more on this topic or Ask a question