cancel
Showing results for 
Search instead for 
Did you mean: 

Start routine Need to take only correct record in Dso and erroneous record in error DTP

Former Member
0 Kudos

This is CSV scenario no ECC involved. I have written these code in Start routine.

I have 3 DSO. I want to load data in dso 3 while loading data i want to check the dso1 and dso2 for source package that these entries are in presents in  dso 1 and dso2. If entry is represent then load the record  if not  then send record to error stack. I have written the code but due to standard functionality of error stack code if the there is erroneous  record in the packet it take the whole packet in error stack. My requirement is to take only erroneous record which are not their in dso1 and dso2 while data in dso3. is their a way i can achieved this .

    TYPES: BEGIN OF TY_SA,

            /BIC/ZCUSTOMER TYPE /BIC/AZSA00-/BIC/ZCUSTOMER,

            /BIC/ZP_ORG    TYPE /BIC/AZSA00-/BIC/ZP_ORG,

            /BIC/ZDOC_TYPE TYPE /BIC/AZSA00-/BIC/ZDOC_TYPE,

            /BIC/ZPUR_ORDR TYPE /BIC/AZSA00-/BIC/ZPUR_ORDR,

             OI_EBELP      TYPE /BIC/AZSA00-OI_EBELP,

          END OF TY_SA.

    DATA: ITAB_SA1 TYPE STANDARD TABLE OF TY_SA.

    FIELD-SYMBOLS <WA_SA1> TYPE TY_SA.

    TYPES: BEGIN OF TY_QUOT,

            /BIC/ZCUSTOMER TYPE /BIC/AZBID_DSO00-/BIC/ZCUSTOMER,

            /BIC/ZP_ORG    TYPE /BIC/AZBID_DSO00-/BIC/ZP_ORG,

            /BIC/ZDOC_TYPE TYPE /BIC/AZBID_DSO00-/BIC/ZDOC_TYPE,

            /BIC/ZPUR_ORDR  TYPE /BIC/AZBID_DSO00-/BIC/ZPUR_ORDR,

            OI_EBELP      TYPE /BIC/AZBID_DSO00-OI_EBELP,

          END OF TY_QUOT.

    DATA: ITAB_QUOT1 TYPE STANDARD TABLE OF TY_QUOT.

    FIELD-SYMBOLS <WA_QUOT1> TYPE TY_QUOT.

    IF SOURCE_PACKAGE IS NOT INITIAL.

*dso1 Structure

      SELECT /BIC/ZCUSTOMER /BIC/ZP_ORG /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR

        OI_EBELP

        FROM /BIC/AZSA00 INTO TABLE ITAB_SA1

        FOR ALL ENTRIES IN SOURCE_PACKAGE

        WHERE /BIC/ZCUSTOMER = SOURCE_PACKAGE-/BIC/ZCUSTOMER

        AND   /BIC/ZP_ORG    = SOURCE_PACKAGE-/BIC/ZP_ORG

        AND   /BIC/ZDOC_TYPE = SOURCE_PACKAGE-/BIC/ZDOC_TYPE

        AND   /BIC/ZPUR_ORDR = SOURCE_PACKAGE-/BIC/ZPUR_ORDR

        AND      OI_EBELP    = SOURCE_PACKAGE-OI_EBELP.

      IF ITAB_SA1 IS NOT INITIAL.

        SORT ITAB_SA1 BY /BIC/ZCUSTOMER /BIC/ZP_ORG

                        /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR OI_EBELP.

      ENDIF.

*dso2 Structure

      SELECT /BIC/ZCUSTOMER /BIC/ZP_ORG /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR

      OI_EBELP

        FROM /BIC/AZBID_DSO00 INTO TABLE ITAB_QUOT1

        FOR ALL ENTRIES IN SOURCE_PACKAGE

        WHERE /BIC/ZCUSTOMER = SOURCE_PACKAGE-/BIC/ZCUSTOMER

        AND   /BIC/ZP_ORG    = SOURCE_PACKAGE-/BIC/ZP_ORG

        AND   /BIC/ZDOC_TYPE = SOURCE_PACKAGE-/BIC/ZDOC_TYPE

        AND   /BIC/ZPUR_ORDR  = SOURCE_PACKAGE-/BIC/ZPUR_ORDR

        AND      OI_EBELP    = SOURCE_PACKAGE-OI_EBELP.

*        AND   /BIC/ZDOC_TYPE = 'QUT'.

      IF ITAB_QUOT1 IS NOT INITIAL.

        SORT ITAB_QUOT1 BY /BIC/ZCUSTOMER /BIC/ZP_ORG

                          /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR OI_EBELP.

      ENDIF.

    ENDIF.

    LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.

      IF <SOURCE_FIELDS>-/BIC/ZDOC_TYPE = 'QUT'.

        READ TABLE ITAB_QUOT1 ASSIGNING <WA_QUOT1>

        WITH KEY /BIC/ZCUSTOMER = <SOURCE_FIELDS>-/BIC/ZCUSTOMER

                 /BIC/ZP_ORG    = <SOURCE_FIELDS>-/BIC/ZP_ORG

                 /BIC/ZDOC_TYPE = <SOURCE_FIELDS>-/BIC/ZDOC_TYPE

                 /BIC/ZPUR_ORDR  = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR

                   OI_EBELP    = <SOURCE_FIELDS>-OI_EBELP

                 BINARY SEARCH.

        IF SY-SUBRC NE 0.

    CLEAR MONITOR_REC.

          MONITOR_REC-msgid   = 'ZMESSAGE'.

          MONITOR_REC-msgty   = 'E'.

          MONITOR_REC-msgno   = '101'.

          MONITOR_REC-msgv1   =

          'This Transactional does not exist in Reference DSO.'.

          MONITOR_REC-msgv2   = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR.

          MONITOR_REC-recno   = <SOURCE_FIELDS>-RECORD.

          MONITOR_REC-skipped = 'X'.

          APPEND MONITOR_REC TO MONITOR.

*          RAISE EXCEPTION TYPE CX_RSROUT_ABORT.

          CONTINUE.

        ENDIF.

        ELSE.

*IF <SOURCE_FIELDS>-/BIC/ZDOC_TYPE IS NOT INITIAL.

IF <SOURCE_FIELDS>-/BIC/ZDOC_TYPE NE 'QUT'.

        READ TABLE ITAB_SA1 ASSIGNING <WA_SA1>

        WITH KEY /BIC/ZCUSTOMER = <SOURCE_FIELDS>-/BIC/ZCUSTOMER

                 /BIC/ZP_ORG    = <SOURCE_FIELDS>-/BIC/ZP_ORG

                 /BIC/ZDOC_TYPE = <SOURCE_FIELDS>-/BIC/ZDOC_TYPE

                 /BIC/ZPUR_ORDR = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR

                  OI_EBELP    = <SOURCE_FIELDS>-OI_EBELP

                 BINARY SEARCH.

        IF SY-SUBRC NE 0.

          MONITOR_REC-msgid   = 'ZMESSAGE'.

          MONITOR_REC-msgty   = 'E'.

          MONITOR_REC-msgno   = '101'.

          MONITOR_REC-msgv1   =

          'This Transactional does not exist in Reference DSO.'.

          MONITOR_REC-msgv2   = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR.

          MONITOR_REC-recno   = <SOURCE_FIELDS>-RECORD.

          MONITOR_REC-skipped = 'X'.

          APPEND MONITOR_REC TO MONITOR.

          DELETE TABLE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.

*          RAISE EXCEPTION TYPE CX_RSROUT_ABORT.

          CONTINUE.

        ENDIF.

      ENDIF.

ENDIF.

ENDLOOP.

Thanks in advance.

Rashid S

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Issue is resolve by the changing the code .

IF SOURCE_PACKAGE IS NOT INITIAL.

       SELECT /BIC/ZCUSTOMER /BIC/ZP_ORG /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR

         FROM /BIC/AZSA00 INTO TABLE ITAB_SA

         FOR ALL ENTRIES IN SOURCE_PACKAGE

         WHERE /BIC/ZCUSTOMER = SOURCE_PACKAGE-/BIC/ZCUSTOMER

         AND   /BIC/ZP_ORG    = SOURCE_PACKAGE-/BIC/ZP_ORG

         AND   /BIC/ZDOC_TYPE = SOURCE_PACKAGE-/BIC/ZDOC_TYPE

         AND   /BIC/ZPUR_ORDR = SOURCE_PACKAGE-/BIC/ZPUR_ORDR.

       IF ITAB_SA IS NOT INITIAL.

         SORT ITAB_SA BY /BIC/ZCUSTOMER /BIC/ZP_ORG

                         /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR.

       ENDIF.

       SELECT /BIC/ZCUSTOMER /BIC/ZP_ORG /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR

         FROM /BIC/AZBID_DSO00 INTO TABLE ITAB_QUOT

         FOR ALL ENTRIES IN SOURCE_PACKAGE

         WHERE /BIC/ZCUSTOMER = SOURCE_PACKAGE-/BIC/ZCUSTOMER

         AND   /BIC/ZP_ORG    = SOURCE_PACKAGE-/BIC/ZP_ORG

         AND   /BIC/ZDOC_TYPE = SOURCE_PACKAGE-/BIC/ZDOC_TYPE

         AND   /BIC/ZPUR_ORDR  = SOURCE_PACKAGE-/BIC/ZPUR_ORDR

         AND   /BIC/ZDOC_TYPE = 'QUT'.

       IF ITAB_QUOT IS NOT INITIAL.

         SORT ITAB_QUOT BY /BIC/ZCUSTOMER /BIC/ZP_ORG

                           /BIC/ZDOC_TYPE /BIC/ZPUR_ORDR.

       ENDIF.

     ENDIF.

     LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.

       LV_FLAG = 0.

       IF <SOURCE_FIELDS>-/BIC/ZDOC_TYPE = 'QUT'.

         READ TABLE ITAB_QUOT ASSIGNING <WA_QUOT>

         WITH KEY /BIC/ZCUSTOMER = <SOURCE_FIELDS>-/BIC/ZCUSTOMER

                  /BIC/ZP_ORG    = <SOURCE_FIELDS>-/BIC/ZP_ORG

                  /BIC/ZDOC_TYPE = <SOURCE_FIELDS>-/BIC/ZDOC_TYPE

                  /BIC/ZPUR_ORDR  = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR

                  BINARY SEARCH.

         IF SY-SUBRC NE 0.

           LV_FLAG = 1.

         ENDIF.

       ELSE. "'SA'

         READ TABLE ITAB_SA ASSIGNING <WA_SA>

         WITH KEY /BIC/ZCUSTOMER = <SOURCE_FIELDS>-/BIC/ZCUSTOMER

                  /BIC/ZP_ORG    = <SOURCE_FIELDS>-/BIC/ZP_ORG

                  /BIC/ZDOC_TYPE = <SOURCE_FIELDS>-/BIC/ZDOC_TYPE

                  /BIC/ZPUR_ORDR = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR

                  BINARY SEARCH.

         IF SY-SUBRC NE 0.

           LV_FLAG = 1.

         ENDIF.

       ENDIF.

       IF LV_FLAG = 1.

           MONITOR_REC-msgid   = 'ZMESSAGE'.

           MONITOR_REC-msgty   = 'E'.

           MONITOR_REC-msgno   = '101'.

           MONITOR_REC-msgv1   =

           'This Transactional does not exist in Reference DSO.'.

           MONITOR_REC-msgv2   = <SOURCE_FIELDS>-/BIC/ZPUR_ORDR.

           MONITOR_REC-recno   = <SOURCE_FIELDS>-RECORD.

           MONITOR_REC-skipped = 'X'.

           APPEND MONITOR_REC TO MONITOR.

           DELETE TABLE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.

*

*          RAISE EXCEPTION TYPE CX_RSROUT_ABORT.

           CONTINUE.

         ENDIF.

ENDLOOP.

Answers (3)

Answers (3)

arivazhagan_sivasamy
Active Contributor
0 Kudos

Hi,

Do not use  DELETE TABLE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.

Instead of you may use  DELETE SOURCE_PACKAGE FROM <SOURCE_FIELDS>.

Arivazhagan S

Former Member
0 Kudos

Hi Arivazhagan

I can not used both of then because i need to send details of erroneous record to client so that next time  they can send  these record and i can load these record  in dso 1 and dso2  and eventually  correct my error dtp.

Thanks 

Former Member
0 Kudos

Hi,

I would suggest to create a direct update DSO (name like error DSO).  From the transformation you can send all the error record to the direct update DSO. You can make a query on top up this (using IS) or extract and send the error details to your business to validate and supply correct value.

Regards

Former Member
0 Kudos

Hi Jugal

thanks for you reply. The problem i am facing these code taking the whole package to error stack.

i want to send only erroneous record to error stack and correct to dso.

Any idea where i am wrong in these code or any suggestion to change the code to achieve this requirement.

Thanks

Rashid S

Former Member
0 Kudos

Hi,

Please try with change the 'MONITOR_REC-msgty   = 'E'.' to MONITOR_REC-msgty   = 'W' .

And in the DTP check execute tab setting for technical request status as 'Request status is set to green if warning occurs'.

Regards

Former Member
0 Kudos

Hi Jugal

It is still taking the data packed to error stack and also adding to dso3.

Could you please have a look at code again to see where i am wrong.

Thanks

Loed
Active Contributor
0 Kudos

Hi,

This may help you on how to use the ERROR DTP..

Just a suggestion, why don't you gather the data in DSO2 and DSO3 and compare it with data going to DSO1?

If incoming data is not present in DSO2 or DSO3 then just delete those data instead of storing them in error dtp..

You may use the DELETE SOURCE_PACKAGE WHERE <comparison> command..

Regards,

Loed

Former Member
0 Kudos

Hi loed

This is my client requirement . I can not delete source_package.

Is there any other way when i run process chain only correct record is loaded in DSO3 and

erroneous record in error dtp.

Thanks

Loed
Active Contributor
0 Kudos

Hi,

Did you read the document I posted? You may compare your code in the code which can be found on that document..

Regards,

Loed

Former Member
0 Kudos

Hi loed

Yes, I read the document but my requirement is different.

Thanks

Rashid S

sander_vanwilligen
Active Contributor
0 Kudos

Hi Rashid,

Please review .

Best regards,

Sander

Former Member
0 Kudos

Hi Sander,

I have already read this but could not my solution.

I have to take correct records in dso3 and erroneous record in error dtp. It is my requirement.

Thanks