Application Development and Automation 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: 
Read only

Reg : Logic

Former Member
0 Likes
686

Hi Experts ,

Im Having two internal tables .. i.e itab1(master data ) & itab2 (transaction data) ..

1 . itab1 has 15 entries & itab2 has 5 entries

My questions is ??

i need entries that are missing from itab1 it has to stored in itab3

i.e itab1 -itab2 = itab3

15 - 5 = 10 .

I Need logic how 2 write this scenario ???

Regs,

Murthy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
667

loop at itab1.

read table itab2 with key f1 = itab1-f1 f2 = itab1-f2.

"<i.e. the common key fields of itab1 and itab2>

if sy-subrc ne 0.

append itab1 to itab3.

endif.

clear : itab1,itab2.

endloop.

here all the int table are with header line if you want for without header line you have to use explicit work area ....

regards

shiba dutta

4 REPLIES 4
Read only

Former Member
0 Likes
668

loop at itab1.

read table itab2 with key f1 = itab1-f1 f2 = itab1-f2.

"<i.e. the common key fields of itab1 and itab2>

if sy-subrc ne 0.

append itab1 to itab3.

endif.

clear : itab1,itab2.

endloop.

here all the int table are with header line if you want for without header line you have to use explicit work area ....

regards

shiba dutta

Read only

Former Member
0 Likes
667

loop at itab2.

delete table itab1 where <key1> = itab2-field and <key2> =itab2-field.

endloop.

Read only

former_member189059
Active Contributor
0 Likes
667

data flag.

loop at itab1.

flag = ''.
loop at itab2.
if itab1 = itab2.
 flag = 'X'.
endif.
endloop.

if flag = ''.
append itab1 to itab3.
endif.

endloop.

Read only

dev_parbutteea
Active Contributor
0 Likes
667

HI,

do like this:

loop at itab1 into work_area.

v_index = sy-tabix.

read table itab2 with key <b>Field1 = field2</b> " put all required fields

if sy-subrc = 0.

do nothing.

else.

append work_area to itab2.

delete itab1 index v_index.

endif.

endloop.

Regards,

Sooness