‎2007 Nov 21 2:24 PM
hi,
iam having two internal tables itab1 and itab2.i have to copy contents of table itab1 to itab2 and delete the duplicate entries in itab2.
please provide the code for this.
thanks in advance
‎2007 Nov 21 2:25 PM
If you have defined your tales with the OCCURS 0.
data: itab1 like mara occurs 0 with header line,
itab2 like mara occurs 0 with header line.
itab1[] = itab2[].
sort itab2.
delete adjacent duplicates from itab2.If you have defined tables with the types than:
data: itab1 type standard table of mara ,
itab2 type standard table of mara .
itab1 = itab2.
sort itab2.
delete adjacent duplicates from itab2.Regards,
Naimesh Patel
Message was edited by:
Naimesh Patel
‎2007 Nov 21 2:25 PM
If you have defined your tales with the OCCURS 0.
data: itab1 like mara occurs 0 with header line,
itab2 like mara occurs 0 with header line.
itab1[] = itab2[].
sort itab2.
delete adjacent duplicates from itab2.If you have defined tables with the types than:
data: itab1 type standard table of mara ,
itab2 type standard table of mara .
itab1 = itab2.
sort itab2.
delete adjacent duplicates from itab2.Regards,
Naimesh Patel
Message was edited by:
Naimesh Patel
‎2007 Nov 21 2:28 PM
Hi Surya,
itab2[] = itab1[].
or
Loop at itab1.
move-corresponding itab1 to itab2.
append itab2.
Endloop.
Note : Ensure that two internal tables must contains the same structure.
Delete duplicate values :
DELETE ADJACENT DUPLICATES FROM ITAB.
Thanks,
Reward If Helpful.
‎2007 Nov 21 2:28 PM
Hi,
You have the copy the values of itab1 to itab2 as below :
itab2[] = itab1[]
or
append lines of itab1 to itab2.
To delete the duplicate entries.
sort itab --> Sort the itab with necessary fields.
delete adjacent duplicates from itab comparing <fieldnames>.
Thanks,
Sriram Ponna.
‎2007 Nov 21 2:37 PM
Hi,
Make sure itab1 & itab2 are of same structure.
itab2[] = itab1[].
delete adjacent duplicates from itab2.
Bye,
kc
‎2007 Nov 21 2:43 PM
Hi,
Do like this
itab2[] = itab1.
sort itab2 by key field.
delete adjacent duplicates from itab2 comparing keyfield.
Regards,
Satish