cancel
Showing results for 
Search instead for 
Did you mean: 

Update field "DLV_BLOCK" using BAPI_SALESORDER_CHANGE

Former Member
0 Kudos

Hi friends,

I am using BAPI_SALESORDER_CHANGE and BAPI_TRANSACTION_COMMIT  to remove delivery block from an Order.

We are updating the below parameters and then calling the bapi.


   st_header_change-dlv_block    = ' '.

   st_header_change_x-updateflag = 'U'.

   st_header_change_x-dlv_block  = 'X'.


  CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

     EXPORTING

       salesdocument    = v_salesdocument

       order_header_in  = st_header_change

       order_header_inx = st_header_change_x

     TABLES

       return           = t_return.


   READ TABLE t_return WITH KEY type = 'E'.

   IF sy-subrc <> 0.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'.


  ENDIF.



But it's still wrong...

The field keeps the same value.


Thanks in advance.

Willian.

Accepted Solutions (0)

Answers (1)

Answers (1)

MariusStoica
Active Participant
0 Kudos

Hi William,

Have you solved this issue ? I'm facing the same result.

Thank you,

Marius

Former Member
0 Kudos

Hi Marius!

Yes! I solved it...

The code below is correct, but in my case there was a wrong code in include MV45AFZZ... this code was changing the value of the field "dlv_block" again, after my update (BAPI_SALESORDER_CHANGE).

Please check if exist some code in any include (EXIT SD) that can change the value of this field after your update. 

.................................................

clear: st_header_change,

          st_header_change_x.


st_header_change-dlv_block      = space.

st_header_change_x-updateflag = 'U'.

st_header_change_x-dlv_block  = 'X'.


call function 'BAPI_SALESORDER_CHANGE'

     exporting

       salesdocument    = v_salesdocument

       order_header_in  = st_header_change

       order_header_inx = st_header_change_x

     tables

       return           = t_return.


read table t_return with key type = 'E'.

if sy-subrc <> 0.


    call function 'BAPI_TRANSACTION_COMMIT'

          exporting

            wait = 'X'.


endif.