Skip to Content
avatar image
Former Member

Deleting Duplicate records

Dear experts,

                        we have a requirement of deleting duplicate records based on reference key.it needs to be done between datasource and dso.i already develop the code .when i test it it takes long time can u please suggest what are the changes i need to do.

actually the senario first the key cantains nothing ie sapce now they are updating the space with some other no in ecc so we need to update that field with updated key and delete that record.

TYPES : begin of ty_temp,

           serialno type /BIC/OI******NO,

         END OF ty_temp.

     DATA:IT_BIC TYPE TABLE OF /BIC/AZFIAPO0300,

          WA_BIC LIKE LINE OF  IT_BIC.

     DATA: WA_SOURCEPACKAGE like LINE OF SOURCE_PACKAGE.

     DATA : it_temp type STANDARD TABLE OF ty_temp,

            wa_temp type ty_temp.

   loop at SOURCE_PACKAGE into WA_SOURCEPACKAGE.

     CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

       EXPORTING

         INPUT         = WA_SOURCEPACKAGE-****R

       IMPORTING

         OUTPUT        = wa_temp-****no.

       append wa_temp to it_temp.

       clear wa_temp.

   endloop.

     

*     IF SOURCE_PACKAGE IS NOT INITIAL.

         SELECT *   FROM /BIC/*****O0300

              INTO TABLE IT_BIC

              FOR ALL ENTRIES IN it_temp

              where /BIC/****NO = it_temp-*****no.

              " Dont have the same type

*        WHERE /BIC/ZDA_REF = ' '.              "Changes

*       AND ZDA_REF = LT_RESULT-XREF1' '.

*  ENDIF.

     sort it_bic by CREDITOR AC_DOC_NO /BIC/*****NO.

     LOOP AT SOURCE_PACKAGE INTO WA_SOURCEPACKAGE.

       READ TABLE it_bic INTO WA_bic WITH KEY CREDITOR =

       WA_SOURCEPACKAGE-LIFNR

                                              AC_DOC_NO =

                                              WA_SOURCEPACKAGE-BELNR

                                              /BIC/ZSERIALNO =

                                              WA_SOURCEPACKAGE-XBLNR

                                              BINARY SEARCH.

       IF SY-SUBRC = 0 and wa_bic-/BIC/****** = ''.     "Changes

            delete from /BIC/AZFIAPO0300 WHERE CREDITOR = wa_bic-creditor

                                           and AC_DOC_NO =

                                           wa_bic-ac_doc_no

                                           and /BIC/ZSERIALNO =

                                           wa_bic-/bic/zserialno

                                           and /BIC/ZDA_REF = ''.

       endif.

     clear : WA_SOURCEPACKAGE, wa_bic.

endloop.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 24, 2014 at 04:55 AM

    Hi,

    instaed select * form use the specifc fields.

    IF SOURCE_PACKAGE IS NOT INITIAL.

             SELECT *   FROM /BIC/*****O0300

                  INTO TABLE IT_BIC

                  FOR ALL ENTRIES IN it_temp

                  where /BIC/****NO = it_temp-*****no.

                  " Dont have the same type

    *        WHERE /BIC/ZDA_REF = ' '.              "Changes

    *       AND ZDA_REF = LT_RESULT-XREF1' '.

    use the spefic fields for the required.

    IF SOURCE_PACKAGE IS NOT INITIAL.

             SELECT x

                            x

                             x

                             x

          FROM /BIC/*****O0300

                  INTO TABLE IT_BIC

                  FOR ALL ENTRIES IN it_temp

                  where /BIC/****NO = it_temp-*****no.

                  " Dont have the same type

    *        WHERE /BIC/ZDA_REF = ' '.              "Changes

    *       AND ZDA_REF = LT_RESULT-XREF1' '.

    if you use the select * form - it will read the total table fields.

    Thanks,

    Phani.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi mahender

                   thank you for the reply.actually in ecc side some records are modifying and adding some extra information thats why we need to delete the records in dso. i will also check other option that u suggest.

      regards

      phani chaithanya