04-13-2007 3:02 PM
Hi All,
I have a internal table itab.
Is there any fuction module or any other way by which i check out all the duplicate entries in my itab and remove it.
regards,
Raman
04-13-2007 3:09 PM
04-13-2007 3:07 PM
Hi Raman...
There is a way to achieve this.
use the statement:
<b>sort itab by field1 field2.
delete adjacent duplicates from itab comparing field1 field2 .
</b>
here itab is the internal table and field1 and field2 are the fields if internal table itab.
see the following link :
<b>http://help.sap.com/saphelp_nw04/helpdata/en/06/aafd54fc4011d195280000e8353423/frameset.htm</b>
Hope it helps you...
Let me know if u have any more doubt...
Reward points if useful......
Suresh.......
04-13-2007 3:09 PM
04-13-2007 3:16 PM
Thanks a lot for all your replies.
I got the soluition.
Just one more question related to the reply from Rich.
how can i define primary key from my internal table
regards,
Raman
04-13-2007 3:18 PM
04-13-2007 3:21 PM
check something like this
DATA: z_itab1 TYPE TABLE OF z_index WITH NON-UNIQUE KEY field1.
04-13-2007 3:10 PM
Hi Raman,
There is no function module which will deletes duplicate entries in an internal table.
But SAP provides you a OPEN SQL statement DELETE statement which will do for your requirement.
Syntax:
<b>DELETE ADJACENT DUPLICATES FROM itab.</b>
Check this link to know about DELETE statement
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/delete_i.htm
Thanks,
Vinay