cancel
Showing results for 
Search instead for 
Did you mean: 

how to loop at two internal table at the same time

Former Member
0 Kudos

i have got the internal table Header.

there are two other internal table item1 and item2.

i need to get the iterate both the internal tables at the same time . how to do it.

Regards,

clara.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

My suggestion is , merge contents of two item tables into another internal table and loop this merged table. If both item tables contain different data related to same item then this job is much easier.

Regards,

Ramesh.

Answers (4)

Answers (4)

Former Member
0 Kudos

Anitha,

Could you explain in detail, what are you trying to do?

Regards,

Ravi

former_member188685
Active Contributor
0 Kudos

data: l_tabix type sy-tabix.

loop at item1.
l_index = sy-tabix.
read table header index l_tabix. 
if sy-subrc = 0.

endif.
endloop.

this way you can loop both

regards

vijay

Former Member
0 Kudos

LOOP AT itab1.

READ TABLE itab2 INDEX SY-INDEX.

ENDLOOP.

Former Member
0 Kudos

loop at itab.

read table itab1 with key fld1 = itab-fld1.

if sy-subrc eq 0.

read table itab2 with key fld1 = itab-fld1.

if sy-subrc eq 0.

endif.

endif.

endloop.

if there r no common fields

then u can use vijay babus suggestion

Message was edited by: chandrasekhar jagarlamudi