Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Checking every entry into internal table

Former Member
0 Kudos

hii i have taken material from lips in first internal table and material from vepo in second internal table

now i want only those entries in second table which r present in first table.

one delivery can have multiple materials in it.

please provide logic.. <REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Feb 12, 2008 2:45 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

LOOP AT itab2.

lv_index = sy-index.

READ TABLE itab1 WITH KEY matnr = itab2-matnr.

IF sy-subrc NE 0.

DELETE itab2 AT INDEX lv_index.

ENDI.

ENDLOOP.

At the end of loop itab2 will have only entries available in itab1.

Regards

Sudhir Atluru

2 REPLIES 2

Former Member
0 Kudos

LOOP AT itab2.

lv_index = sy-index.

READ TABLE itab1 WITH KEY matnr = itab2-matnr.

IF sy-subrc NE 0.

DELETE itab2 AT INDEX lv_index.

ENDI.

ENDLOOP.

At the end of loop itab2 will have only entries available in itab1.

Regards

Sudhir Atluru

former_member191735
Active Contributor
0 Kudos

apart from the above answert.... Sort the itab1 and use binary search in read statement (if you think, you will have more than 100 records).