‎2007 Jul 17 4:17 AM
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
‎2007 Jul 17 4:27 AM
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
‎2007 Jul 17 4:27 AM
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
‎2007 Jul 17 4:28 AM
loop at itab2.
delete table itab1 where <key1> = itab2-field and <key2> =itab2-field.
endloop.
‎2007 Jul 17 4:28 AM
data flag.
loop at itab1.
flag = ''.
loop at itab2.
if itab1 = itab2.
flag = 'X'.
endif.
endloop.
if flag = ''.
append itab1 to itab3.
endif.
endloop.
‎2007 Jul 17 4:58 AM
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