Skip to Content
0
Jan 04, 2016 at 05:42 PM

bapi_inb_delivery_change modify quantity

1247 Views

All,

I am trying to modify the delivered quantity of a inbound delivery using bapi_inb_delivery_change BAPI.

I have reached to a point on which I do not understand what is happening, the BAPI returns a error code 004 with message type VLBAPI, I suppose that some information is missing but I dont know what...

I attach my code:

TYPES : lty_dead TYPE STANDARD TABLE OF bapidlvdeadln.

DATA :lt_header_deadlines TYPE lty_dead,

wa_header_deadlines TYPE bapidlvdeadln,

wa_header_control TYPE bapiibdlvhdrctrlchg,

it_return TYPE STANDARD TABLE OF bapiret2,

wa_delivery TYPE bapiibdlvhdrchg-deliv_numb,

wa_header_data TYPE bapiibdlvhdrchg.

DATA: item_data LIKE bapiibdlvitemchg OCCURS 0.

DATA: wa_item_data LIKE bapiibdlvitemchg.

DATA: item_control LIKE bapiibdlvitemctrlchg OCCURS 0.

DATA: wa_item_control LIKE bapiibdlvitemctrlchg.

write : sy-datum.

* fecha limite de entrega

wa_header_deadlines-deliv_numb = '0180000600'.

wa_header_deadlines-timetype = 'WSHDRLFDAT'. "Delivery date

wa_header_deadlines-timestamp_utc = 20120909000000. "YYYYMMDDHHMMSS

wa_header_deadlines-timezone = 'ALA'. "Western Europe

APPEND wa_header_deadlines TO lt_header_deadlines.

wa_header_data-deliv_numb = '0180000600'.

wa_header_control-deliv_numb = '0180000600'.

wa_header_control-deliv_date_flg = 'X'.

***********************************************************************

*DATA: ls_item TYPE bapiibdlvitemchg.

DATA: ls_lips type LIPSVB.

*SELECT SINGLE lfimg lgmng lfimg_flo lgmng_flo umvkz umvkn umrev

* FROM lips

* INTO (wa_item_data-dlv_qty, wa_item_data-dlv_qty_imunit, wa_item_data-del_qty_flo, wa_item_data-dlv_qty_st_flo,

* wa_item_data-fact_unit_nom, wa_item_data-fact_unit_denom, wa_item_data-conv_fact)

SELECT single * from lips into ls_lips

WHERE vbeln = '0180000600'

AND posnr = '000010'.

CALL FUNCTION 'MAP2E_LIPS_TO_BAPIIBDLVITEMCHG'

EXPORTING

LIPSVB = ls_lips

CHANGING

BAPIIBDLVITEMCHG = wa_item_data

.

CLEAR: wa_item_data.

wa_item_data-deliv_numb = '0180000600'.

wa_item_data-deliv_item = '000010'.

*wa_item_data-dlv_qty = '3000'.

*wa_item_data-dlv_qty_imunit = '3000'.

*wa_item_data-sales_unit = 'KG'.

*wa_item_data-sales_unit_iso = 'KG'.

*wa_item_data-base_uom = 'KG'.

*wa_item_data-base_uom_iso = 'KG'.

*wa_item_data-gross_wt = '3000'.

*wa_item_data-unit_of_wt = 'KG'.

*wa_item_data-volume = '1500'.

*wa_item_data-volumeunit = 'M3'.

APPEND wa_item_data TO item_data.

CLEAR: wa_item_control.

wa_item_control-deliv_numb = '0180000600'.

wa_item_control-deliv_item = '000010'.

wa_item_control-chg_delqty = 'X'.

wa_item_control-VOLUME_FLG = 'X'.

wa_item_control-NET_WT_FLG = 'X'.

wa_item_control-GROSS_WT_FLG = 'X'.

APPEND wa_item_control TO item_control.

**********************************************************************

CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'

EXPORTING

header_data = wa_header_data

header_control = wa_header_control

delivery = wa_delivery

TABLES

header_deadlines = lt_header_deadlines

item_data = item_data

item_control = item_control

return = it_return.

IF sy-subrc EQ 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.


Regards


Jon