Skip to Content
0
Former Member
Dec 20, 2012 at 02:35 PM

loop in loop performance

27 Views

I have to make loop inside a loop ı am looking fastest way to do

my internal tables likes these (not exactly but similiar)

data begin of itabex

matnr like mara-matnr

lgort like mspr-lgort

charg like mspr-charg

data end of itabex

data begin of itabin

matnr like mara-matnr

lgort like mspr-lgort

charg like mspr-charg

data end of itabin

loop at itabex

loop at itabin where matnr eq itabex-matnr

and lgort eq itabex-lgort

endloop

endloop.

or

sort itabin by matnr lgort.

loop at itabex.

read table itabin with key matnr = itabex-matnr

lgort = itabex-lgort binary search.

if sy-subrc eq 0.

lv_tabix = sy-tabix.

loop at itabin from lv_tabix.

if itabin-matnr ne itabex-matnr or

itabin-lgort ne itabex-lgort.

exit.

endif.

endloop

endif.

endloop

or much more better way to do

Moderator message: duplicate post.

Message was edited by: Thomas Zloch