Skip to Content

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

read in loop

Hi all ,

I have one internal table itab1 as

mblnr zeile vgbel lifnr

11 1 z 08

11 2 z 77

11 3 z 76

11 4 z 75

11 5 z 08

12 1 z 76

12 2 z 75

12 3 z 77

12 4 z 76

12 5 z 77

13 1 z 77

13 2 z 76

13 3 z 77

Another itab2 as

vbeln zeile vgbel

A 1 z

A 2 z

A 3 z

A 4 z

A 5 z

B 1 z

B 2 z

B 3 z

B 4 z

B 4 z

C 1 z

C 1 z

C 1 z

Mblnr should link to vbeln in asending order i.e: A for 11 etc .,

There is no direct linkage I could find in between mblnr & vbeln and even for lifnr .So recordpointer’s are based only on vgbel & zeile .

Loop at itab1 into ls_a1 .

Read table itab2 into ls_b1

with key vgbel = ls_a1-vgbel

Zeile = ls_a1-zeile .

V_tabix = sy-tabix .

Do something.

Modify itab1 from ls_a1 .

Delete ls_b1 index v_tabix .

Delete itab1 .

Endloop.

Itab1-mblnr corresponds to itab1-vbeln .

So for a selection from mblnr 11 to 13 , every thing works fine .But if I select for a lifnr 77

Itab1 contains

mblnr zeile vgbel lifnr

11 2 z 77

12 3 z 77

12 5 z 77

13 1 z 77

13 3 z 77

and itab2 is as it is .

But with the same logic ,

For sy-index 1 of itab1 it’s right .

Now for the sy-index 2 of itab1 , read table can indicate itab2 as

A 3 z instead of B 3 z because no direct link is there in between A B C and 11 22 33 .

Is there any way I can read the proper record from itab2 ? any other internal table validation of zeile with respect to mblnr and vbeln or any ztable ?

Any help !!!

Regards ,

Sun

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