Skip to Content
avatar image
Former Member

BAPI_INB_DELIVERY_CHANGE not updating Inbound delivery

I am using BAPI_INB_DELIVERY_CHANGE to update BATCH number in my inbound delivery. I am also using the BAPI_TRANSACTION_COMMIT all the call is successful not error but still the inbound delivery is not getting updated.

*header
ls_header_data-deliv_numb = '0180001104'.

*header control
ls_header_control-deliv_numb = '0180001104'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_vbeln
IMPORTING
output = p_vbeln.

SELECT * FROM lips
INTO TABLE lt_lips_tab
WHERE vbeln = p_vbeln.

LOOP AT lt_lips_tab INTO ls_lips_tab.
*item data
ls_item_data-deliv_numb = p_vbeln.
ls_item_data-deliv_item = ls_lips_tab-posnr.
ls_item_data-material = ls_lips_tab-matnr.
ls_item_data-batch = '8FEB-00100'.
ls_item_data-dlv_qty = ls_lips_tab-lfimg.
ls_item_data-dlv_qty_imunit = ls_lips_tab-lgmng.
ls_item_data-fact_unit_nom = ls_lips_tab-umvkz.
ls_item_data-fact_unit_denom = ls_lips_tab-umvkn.
ls_item_data-gross_wt = ls_lips_tab-brgew.
ls_item_data-net_weight = ls_lips_tab-ntgew.
APPEND ls_item_data TO lt_item_data.
ls_item_control-deliv_numb = p_vbeln.
ls_item_control-deliv_item = ls_lips_tab-posnr.
ls_item_control-chg_delqty = ls_lips_tab-lfimg.
* ls_item_control-DEL_ITEM = 'X'.
APPEND ls_item_control TO lt_item_control.
CLEAR ls_item_data.
ENDLOOP.

CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'
EXPORTING
header_data = ls_header_data
header_control = ls_header_control
delivery = '0180001104'
TABLES
* header_partner = lt_header_partner
* header_partner_addr = lt_header_partner_addr
* header_deadlines = lt_header_deadlines
item_data = lt_item_data
item_control = lt_item_control
* item_serial_no = lt_item_serial_no
* extension1 = lt_extension1
* extension2 = lt_extension2
return = lt_return
* tokenreference = lt_tokenreference
* handling_unit_header = lt_handling_unit_header
* handling_unit_item = lt_handling_unit_item
* partial_gr_objects = lt_partial_gr_objects
EXCEPTIONS
OTHERS = 1.
IF lt_return IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* wait = 'X'
IMPORTING
return = ls_return.
IF lt_return IS NOT INITIAL.

ENDIF.
ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 10, 2017 at 02:31 PM

    There are several issues with your call

    ls_item_control-chg_delqty = ls_lips_tab-lfimg.

    Have you looked at the actual data type of the chg_delqty? How can it take the quantity? It is a single character boolean field, if it is X then the change happens.

    IF lt_return IS INITIAL.

    This will always be initial. You are looking at the header line here which is an obsolete way of using internal tables. If you want to check if there is anything in the internal table do either one of the following (depending on your system)

    IF lt_return[] IS INITIAL.
      or
    IF lines( lt_return ) > 0.  "ABAP 7.4 and greater

    This does not account for the fact that several BAPIs do send success messages and other warnings in the return too. So, using that you will be bailing even if there is a Success message. You need to be looking for Error messages specifically.

    "Pre- 7.4
    READ TABLE lt_return WITH KEY type = 'E'.
    or 
    LOOP AT lt_return WHERE type = 'E'.
    
    " > 7.4
    IF lines( lt_return[ type = 'E' ] ) > 0.
    Add comment
    10|10000 characters needed characters exceeded