Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

fetching duplicate record entries

Hi all,

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,

Winnie.

Tags:
replied

Hi,

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.

ELSE.

APPEND that record to internal table. After end loop send this internal table as mail.

ENDIF.

ENDLOOP.

Thanks,

Vinod.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question