‎2007 Jul 30 12:11 PM
Hi,
I have a internal table with two columns c1 and c2.
I have three records r1,r2 and r3.These records are ,
A1 B1
A2 B2
A3 B3
Now i can have a record,
A1 B2
but not a record like,
A1 B1
again,so the duplication of the record need to be prevented.I need to know how to check for the duplication of existing records in the internal table with the newly added record.
Thank you.
Regards,
Harish
‎2007 Jul 30 12:12 PM
‎2007 Jul 30 12:12 PM
‎2007 Jul 30 12:13 PM
Can you elaborate?Also will this not affect the performace when it comes to many number of records being handled?
‎2007 Jul 30 12:16 PM
You can use the READ TABLE statement to check for duplicate entries.
READ TABLE itab WITH KEY c1 = value1
c2 = value2.
IF sy-subrc eq 0.
" Duplicate records exist
ENDIF.Please mark points if the solution was useful.
Regards,
Manoj
‎2007 Jul 30 12:13 PM
SORT ITAB BY <C1> <C2> .
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING C1 C2.
IF SY-SUBRC EQ 0.
<implies there are duplicate entries and are deleted>.
ELSE.
<no duplicate entries>
ENDIF.
Regards,
Pavan
‎2007 Jul 30 12:20 PM
Hi Harish,
SORT ITAB BY C1, C2.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING C1 C2.
<b>
Regards,
Azhar</b>