Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

By using BAPI_OUTB_DELIVERY_CHANGE updating values issue

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

Did you check your implementation of BAdI SMOD_V50B0001: Look for problem solved by implicit db commit or delay during debug execution.

Question: IDoc SHP_OBDLV_CHANGE01?

Regards,

Raymond

14 REPLIES 14

raymond_giuseppi
Active Contributor

Did you check your implementation of BAdI SMOD_V50B0001: Look for problem solved by implicit db commit or delay during debug execution.

Question: IDoc SHP_OBDLV_CHANGE01?

Regards,

Raymond

0 Kudos

Hi Raymond,

I have checked BAdi IF_EX_SMOD_V50B0001~EXIT_SAPLV50I_010

after using commit work and wait also its not updating.

best Regards,

Raghava

0 Kudos

Where did you code this COMMIT, not in the BAdI ?

0 Kudos

Hi Raymond,

In BADi only .

Still not updating values in normal process .

Best Regards,

Raghava

I don't think you are allowed to commit at this step, seems you may break the "transaction" (precocious commit, unlock of record, etc.)


You should only change CS_VBKOK, CT_VBPOK and CT_VBSUPCON from data of EXTENSION1 and-2. Let the system do the commit.

Regards;

Raymond

0 Kudos

Hi Raymond,

I am updating CS_VBKOK table by using EXTENSION1 and-2.

but still i am facing same issue .

In debug mode values updating fine with same code but not in normal process .

Best Regards,

Raghava

0 Kudos

I already asked for, but which IDoc do you use?

0 Kudos

Its inbound idoc and not a stand one.

its  ZMessage type.

0 Kudos

Could you post most relevant code of your inbound FM (BD51)?

0 Kudos

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 Kudos

hi ,

I am using the same code for different Msg type and IDOC FM its working fine as per expectations.

But other msg type and FM Z_IDOC_INPUT_DELVRY  its not working.

Best Regards,

Raghava

0 Kudos

Issue solved my self thank you for your help.

Best Regards,

Raghava

0 Kudos

Out of curiosity,  what was the error?

0 Kudos

In IDOC Z**FM

having different logic like  SGI Split delivery check before  posting PGI

                                          Purcharse Order should be referred in invoice document and accounting document

for self billing invoices created  using  Consignment and Pipeline settlement (MRKO)

PO quantity when 3PL rejects the Qty.

where qty is zero after split process Change is only for SPL qualifier in Ship  confirmation IDOC. Message : Z**.


Those many logic's are there to update delivery in same FM .


Previously i have written my code after all this process .


Now changed to before all this logic ..nothing more than that i didn't do.



Best Regards,

Raghava