Skip to Content
avatar image
Former Member

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 09, 2008 at 11:36 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 09, 2008 at 11:03 AM

    Hi,

    Use GUI_UPLOAD function module to upload the records from presentation server to Internal table.

    Now delete the duplicate records from internal table using delete adjacent duplicate statement.

    then insert the records from internal table to DB table.

    regards,

    Sujit

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Suppose the table sflight.

      try this way-

      Loop at itab1 into wa1.
        Loop at itab1 into wa2 where carrid = wa1-carrid
                                                   connid = wa1-connid.
         Append wa2 to tab2.
       endloop.
      Endloop.

      Now internal table itab2 has the duplicate records if there are any.