03-24-2008 7:02 AM
Hi,
Could please help me by comparing two internal tables i have to get data into one of the internal table which do not have the data of other internal table. How to do this?
for example: itab has 2 records.
a b
c d
itab1 has 2 records
z n
s g
now my itab should have
a b
c d
z b
s b
z d
s d
how to write the code for this.
Thanks in advance.
03-24-2008 7:05 AM
Hi Srilatha,
Do like this.
APPEND LINES OF itab1 TO itab.
Thanks,
Vinod.
03-24-2008 7:10 AM
hi,
pass data of one iternal table into another by
itab1 = itab2
thanks ®ards,
pankaj vashista
03-24-2008 7:17 AM
Move the 2 internal table data to one internal table & delete the duplicate entries.
ex:
append lines of itab2 to itab1.
sort itab1 by field1 field2.
delete adjacent duplicates from itab1 comparing field1 field2.
03-24-2008 7:23 AM
Hi,
Check this out..
itab2[] = itab[].
loop at itab into wa.
loop at itab1 into wa1.
wa-fld1 = wa1-fld1.
append wa to itab2.
endloop.
endloop.
now the itab2 will have the values like you require.
Itab2 ,and the workareas should have the type of itab.
Reward if helpful.
Regards.
Edited by: Akshay Raj on Mar 24, 2008 8:24 AM
03-24-2008 7:58 AM
Hi,
Do like this.
itab2 [ ] = itab [ ].
loop at itab into wa.
loop at itab1 into wa1 where fld1 NE wa-fld1 AND fld2 NE wa-fld2.
wa-fld1 = wa1-fld1.
append wa to itab2.
endloop.
endloop.
by this no duplicates will come into table itab2.
Please reward if useful.
Regards,
Ramesh
Edited by: Ramesh Jakkula on Mar 24, 2008 8:58 AM
03-24-2008 8:25 AM
I understand the following. you have internal tables itab itab1. Also that they have two fields, lets call them x and y.
we will declare a work area wa_tab, wa_tab1 of the same type as the internal table.
Now:
>Your requirement:
>itab has 2 records.
>a b
>c d
>itab1 has 2 records
>z n
>s g
>now my itab should have
>a b
>c d
>z b
>s b
>z d
>s d
Suggestion:
loop at itab1 into wa_tab1.
loop at itab into wa_tab.
wa_tab-x = wa_tab1-x.
append wa_tab to itab.
endloop.
endloop.
03-24-2008 8:26 AM
Hi Srilatha,
Do like this .
itab2[] = itab[].
loop at itab2 into wa2.
loop at itab1 into wa1.
wa2-field1 = wa1-field1
append wa2 to itab.
endloop.
endloop.
Hope this will help you.
03-24-2008 8:27 AM
Hi Srilatha,
Do like this .
take another internal table itab2.
itab2[ ] = itab[ ].
loop at itab2 into wa2.
loop at itab1 into wa1.
wa2-field1 = wa1-field1
append wa2 to itab.
endloop.
endloop.
Hope this will help you.
03-24-2008 8:45 AM
Using append itab into itab1 stetement we can populate the datas from one internal table to another.
to delete the duplicate entries please use this statement DELETE ADJACENT DUPLICATES FROM itab.