Skip to Content

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

By using BAPI_OUTB_DELIVERY_CHANGE updating values issue

By using BAPI_OUTB_DELIVERY_CHANGE updating the data in delivery header level by using extension method process after completing FM using BAPI_Transaction_Commit as well ,when i am trying to execute in debug mode data updating but in normal process  (through IDOC we19) not updating

could you please some one help me on this.

Best Regards,

Raghava

Former Member
Former Member replied

IDOC FM  : Z_IDOC_INPUT_DELVRY

                     Perform update_eta_data

                        From  update_eta_data

IF s_dl20-vbeln IS NOT INITIAL.

     ls_header-deliv_numb = s_dl20-vbeln.

     ls_header_control-deliv_numb = s_dl20-vbeln.

     ls_ext1-field1 = 'ZZETADATE'.

     ls_ext1-field2 = 'ZZETATIME'.

     ls_ext1-field3 = 'ZZETARC'.

     ls_ext1-field4 = 'ZZETARCD'.

     APPEND ls_ext1 TO lt_ext1.

     CLEAR ls_ext1.

     IF s_zdl20-etadate IS NOT INITIAL .

       ls_ext2-param     = 'LIKP'.

       ls_ext2-row       = '1'.

       ls_ext2-field     = 'ZZETADATE'.           "Z FIELD 2

       ls_ext2-value     s_zdl20-etadate.

       ls_ext2-type      = 'DATS'.

       ls_ext2-length    = '8'.

       APPEND ls_ext2 TO lt_ext2.

       CLEAR : ls_ext2.

     ENDIF.

     IF s_zdl20-etatime IS NOT INITIAL.

       ls_ext2-param     = 'LIKP'.

       ls_ext2-row       = '1'.

       ls_ext2-field     = 'ZZETATIME'.           "Z FIELD 2

       ls_ext2-value     s_zdl20-etatime.

       ls_ext2-type      = 'TIMS'.

       ls_ext2-length    = '6'.

       APPEND ls_ext2 TO lt_ext2.

       CLEAR : ls_ext2.

     ENDIF.

     IF s_zdl20-zzetarc IS NOT INITIAL.

       ls_ext2-param     = 'LIKP'.

       ls_ext2-row       = '1'.

       ls_ext2-field     = 'ZZETARC'.           "Z FIELD 2

       ls_ext2-value     s_zdl20-zzetarc.

       ls_ext2-type      = 'CHAR'.

       ls_ext2-length    = '4'.

       APPEND ls_ext2 TO lt_ext2.

       CLEAR : ls_ext2.

     ENDIF.

     IF s_zdl20-zzetarcd IS NOT INITIAL.

       ls_ext2-param     = 'LIKP'.

       ls_ext2-row       = '1'.

       ls_ext2-field     = 'ZZETARCD'.           "Z FIELD 2

       ls_ext2-value     s_zdl20-zzetarcd.

       ls_ext2-type      = 'CHAR'.

       ls_ext2-length    = '120'.

       APPEND ls_ext2 TO lt_ext2.

       CLEAR : ls_ext2.

     ENDIF.

**Bapi to change delivery

     CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'   (inside of this BAPI calling Badi IF_EX_SMOD_V50B0001~EXIT_SAPLV50I_010)

       EXPORTING

         header_data    = ls_header

         header_control = ls_header_control

         delivery       = s_dl20-vbeln

       TABLES

         extension1     = lt_ext1

         extension2     = lt_ext2

         return         = ls_return.

*    COMMIT WORK AND WAIT." UP TO 5 SECONDS .

     READ TABLE ls_return WITH KEY type = 'E' TRANSPORTING

                                              NO FIELDS  .

     IF sy-subrc <> 0.

*- Check for Abort message

       READ TABLE ls_return WITH KEY type = 'A' TRANSPORTING

                                                NO FIELDS.

       IF sy-subrc <> 0.

         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

           EXPORTING

             wait = 'X'.

       ENDIF.

     ENDIF.

**To update the inbound idoc delivery level relation tab

     obj_rola-objtype = 'IDOC'.

     obj_rola-objkey  = idoc_contrl-docnum.

     obj_rolb-objkey  = s_dl20-vbeln.

     obj_rolb-objtype = 'LIKP'.

     relation = 'IDC1' .

     CALL FUNCTION 'BINARY_RELATION_CREATE'

       EXPORTING

         obj_rolea    = obj_rola

         obj_roleb    = obj_rolb

         relationtype = relation

       EXCEPTIONS

         OTHERS       = 4.

     COMMIT WORK.

   ENDIF.

   FREE : lt_ext1,lt_ext2,ls_return.

BADI code :

CLEAR ls_bapiextt.

   READ TABLE extension2 INTO ls_bapiextt WITH KEY param = 'LIKP'

                                               field = 'ZZETADATE'.

   IF sy-subrc EQ 0.

     cs_vbkok-zzetadate = ls_bapiextt-value.

   ENDIF.

   CLEAR ls_bapiextt.

   READ TABLE extension2 INTO ls_bapiextt WITH KEY param = 'LIKP'

                                             field = 'ZZETATIME'.

   IF sy-subrc EQ 0.

     cs_vbkok-zzetatime = ls_bapiextt-value.

   ENDIF.

   CLEAR ls_bapiextt.

   READ TABLE extension2 INTO ls_bapiextt WITH KEY param = 'LIKP'

                                             field = 'ZZETARC'.

   IF sy-subrc EQ 0.

     cs_vbkok-zzetarc = ls_bapiextt-value.

   ENDIF.

   CLEAR ls_bapiextt.

   READ TABLE extension2 INTO ls_bapiextt WITH KEY param = 'LIKP'

                                             field = 'ZZETARCD'.

   IF sy-subrc EQ 0.

     cs_vbkok-zzetarcd = ls_bapiextt-value.

   ENDIF.


Best Regards,

Raghava

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question