fetching duplicate record entries
I am having some data in a DB table, and i am trying to upload some records into the DB table using an excel sheet. I must find the duplicate records if any from the excel sheet ,ased on the primary key alone,and send those records as a mail to the user.
Please,if ny of you people could provide me with a logic to go ahead.
Thanks in advance,
Vinod Vemuru replied
Check this logic.
Upload data to itab1.
SORT: itab1 BY primary key.
itab2 = itab1.
DELETE ADJACENT DUPLICATES FROm itab2 COMPARING primary key.
LOOP AT itab1 INTO wa.
READ TABLE itab2 WITH KEY primary keys BINARY SEARCH TRANSPORTING NO FIELDS .
If sy-subrc IS INITIAL.
update data base table.
APPEND that record to internal table. After end loop send this internal table as mail.