2008 Jul 23 10:15 PM
Hi Experts,
Could someone tell me how I can make use of BAPI_OUTB_DELIVERY_CHANGE to create a Batch Split.
I need an output like this:
LIPS table before Batch split.
Delivery Line Item Matnr Qty UOM
-
80001200 10 100 2 EA
80001200 20 101 10 EA
-
LIPS after Batch Split.
Delivery Line Item Matnr Qty UOM
-
80001200 10 100 2 EA
80001200 20 101 10 EA
80001200 900001 100 EA
80001200 900002 100 EA
-
Thanks in advance.
2008 Jul 24 7:06 AM
Hi Hari
To create a batch line item using this BAPI, you need to do two things:
1) In the header structures, fill in the delivery number wherevr applicable.
In the structure techn_control : fill "U" , in the update indicator field.
2) In the table ITEM_DATA, first create a line for the header line item (0010).
In this line fill the del number, item number, material , fact_unit_nom and fact_unit_denom.
Then create a new entry for the sub line item that you want to create (90001).
Here, enter the del num, item num (90001), material, batch number, dlv_qty, dlv_qtyimunit, fact_unit_nom and fact_unit_denom. Do likewise for your second header line item (20). So this table should now have 4 entries.
Now in the table item_control, create a new line with delivery num, delivery item (10) and chg_delqty = 'X'. Do the same for each line item. (90001,20,9001).
Call the BAPI transaction commit after this BAPI, and you should be able to update the delivery.
Hope this helps.
Cheers
Ravish
Hi Hari
To create a batch line item using this BAPI, you need to do two things:
1) In the header structures, fill in the delivery number wherevr applicable.
In the structure techn_control : fill "U" , in the update indicator field.
2) In the table ITEM_DATA, first create a line for the header line item (0010).
In this line fill the del number, item number, material , fact_unit_nom and fact_unit_denom.
Then create a new entry for the sub line item that you want to create (90001).
Here, enter the del num, item num (90001), material, batch number, dlv_qty, dlv_qtyimunit, fact_unit_nom and fact_unit_denom. Do likewise for your second header line item (20). So this table should now have 4 entries.
Now in the table item_control, create a new line with delivery num, delivery item (10) and chg_delqty = 'X'. Do the same for each line item. (90001,20,9001).
Call the BAPI transaction commit after this BAPI, and you should be able to update the delivery.
Hope this helps.
Cheers
Ravish
2008 Jul 24 7:06 AM
Hi Hari
To create a batch line item using this BAPI, you need to do two things:
1) In the header structures, fill in the delivery number wherevr applicable.
In the structure techn_control : fill "U" , in the update indicator field.
2) In the table ITEM_DATA, first create a line for the header line item (0010).
In this line fill the del number, item number, material , fact_unit_nom and fact_unit_denom.
Then create a new entry for the sub line item that you want to create (90001).
Here, enter the del num, item num (90001), material, batch number, dlv_qty, dlv_qtyimunit, fact_unit_nom and fact_unit_denom. Do likewise for your second header line item (20). So this table should now have 4 entries.
Now in the table item_control, create a new line with delivery num, delivery item (10) and chg_delqty = 'X'. Do the same for each line item. (90001,20,9001).
Call the BAPI transaction commit after this BAPI, and you should be able to update the delivery.
Hope this helps.
Cheers
Ravish
2008 Sep 08 10:58 AM
I had follow Ravish's suggestion , then adjust some procedure step.
Share my ABAP program .
Thanks Ravish share.
&----
*& Report YSD_DELIVERY_UPDATE_TEST *
*& *
&----
*& Describe: When Create sales delivery from ERP, we will wait WMS detmerin batch split .
*& So we will update the sales delivery document with posting GD.
*& This sample will show the update delivery process.
*&
*& Delivery structure befor WMS update picking qty:
*&
*& Delivery Line Item Matnr Qty UOM
*& ________________________________________
*& 80708001 10 6208627 2000 EA
*&
*& Delivery structure after WMS batch determin with batch picking qty:
*&
*& Delivery Line Item Hieraritem Usehieritm Matnr Batch Qty UOM Fact_unit_nom Fact_unit_denom
*& _______________________________________________________________________________________________________
*& 80708001 10 6208627 EA 1 1
*& 80708001 900001 10 1 6208627 S002 1000 EA 1 1
*& 80708001 900002 10 1 6208627 S002 1000 EA 1 1
*&
*& SAP Process step:
*& 1.Create Batch split record by BAPI_OUTB_DELIVERY_CHANGE
*& 2.fill the pick qty and GD by WS_DELIVERY_UPDATE
&----
REPORT YSD_DELIVERY_UPDATE_TEST .
DATA : I_HEADER_DATA LIKE BAPIOBDLVHDRCHG. "Delivery header
DATA : I_HEADER_CONTROL LIKE BAPIOBDLVHDRCTRLCHG. "delivery header control
DATA : I_DELIVERY_NO LIKE BAPIOBDLVHDRCHG-DELIV_NUMB. "deliver number
DATA : I_TECHN_CONTROL LIKE BAPIDLVCONTROL. "TECHN_CONTROL
DATA : I_ITEM_DATA LIKE BAPIOBDLVITEMCHG OCCURS 0 WITH HEADER LINE. "ITEM_DATA delivery item
DATA : I_ITEM_CONTROL LIKE BAPIOBDLVITEMCTRLCHG OCCURS 0 WITH HEADER LINE. "ITEM_CONTROL
DATA : I_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE. "Return
*Set Delivery Header data
I_DELIVERY_NO = '0080708001'.
I_HEADER_DATA-DELIV_NUMB = I_DELIVERY_NO.
I_TECHN_CONTROL-UPD_IND = 'U'.
I_HEADER_CONTROL-DELIV_NUMB = I_DELIVERY_NO.
*Create Delivery item by WMS return batch split
*First item from delivery item
*I_ITEM_DATA-DELIV_NUMB = I_DELIVERY_NO.
*I_ITEM_DATA-DELIV_ITEM = '10'.
*I_ITEM_DATA-MATERIAL = '6208627'.
*I_ITEM_DATA-FACT_UNIT_NOM = 1.
*I_ITEM_DATA-FACT_UNIT_DENOM = 1.
*append I_ITEM_DATA.
*clear I_ITEM_DATA.
I_ITEM_DATA-DELIV_NUMB = I_DELIVERY_NO.
I_ITEM_DATA-DELIV_ITEM = '900001'.
I_ITEM_DATA-HIERARITEM = '10'. "The batch split record below delivery item hierary
I_ITEM_DATA-USEHIERITM = '1'.
I_ITEM_DATA-MATERIAL = '6208627'.
I_ITEM_DATA-BATCH = 'S002'.
I_ITEM_DATA-DLV_QTY = 1000.
*I_ITEM_DATA-DLV_QTY_IMUNIT = 1000.
I_ITEM_DATA-FACT_UNIT_NOM = 1.
I_ITEM_DATA-FACT_UNIT_DENOM = 1.
append I_ITEM_DATA.
clear I_ITEM_DATA.
I_ITEM_DATA-DELIV_NUMB = I_DELIVERY_NO.
I_ITEM_DATA-DELIV_ITEM = '900002'. "The batch split record below delivery item hierary
I_ITEM_DATA-HIERARITEM = '10'.
I_ITEM_DATA-USEHIERITM = '1'.
I_ITEM_DATA-MATERIAL = '6208627'.
I_ITEM_DATA-BATCH = 'S002'.
I_ITEM_DATA-DLV_QTY = 1000.
*I_ITEM_DATA-DLV_QTY_IMUNIT = 1000.
I_ITEM_DATA-FACT_UNIT_NOM = 1.
I_ITEM_DATA-FACT_UNIT_DENOM = 1.
append I_ITEM_DATA.
clear I_ITEM_DATA.
I_ITEM_CONTROL-DELIV_NUMB = I_DELIVERY_NO.
I_ITEM_CONTROL-DELIV_ITEM = '10'.
I_ITEM_CONTROL-CHG_DELQTY = 'X'.
append I_ITEM_CONTROL.
clear I_ITEM_DATA.
I_ITEM_CONTROL-DELIV_NUMB = I_DELIVERY_NO.
I_ITEM_CONTROL-DELIV_ITEM = '900001'.
I_ITEM_CONTROL-CHG_DELQTY = 'X'.
append I_ITEM_CONTROL.
clear I_ITEM_DATA.
I_ITEM_CONTROL-DELIV_NUMB = I_DELIVERY_NO.
I_ITEM_CONTROL-DELIV_ITEM = '900002'.
I_ITEM_CONTROL-CHG_DELQTY = 'X'.
append I_ITEM_CONTROL.
clear I_ITEM_DATA.
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
HEADER_DATA = I_HEADER_DATA
HEADER_CONTROL = I_HEADER_CONTROL
DELIVERY = I_DELIVERY_NO
TECHN_CONTROL = I_TECHN_CONTROL
TABLES
HEADER_PARTNER =
HEADER_PARTNER_ADDR =
HEADER_DEADLINES =
ITEM_DATA = I_ITEM_DATA
ITEM_CONTROL = I_ITEM_CONTROL
ITEM_SERIAL_NO =
SUPPLIER_CONS_DATA =
EXTENSION1 =
EXTENSION2 =
TOKENREFERENCE =
RETURN = I_RETURN.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN =
ENDIF.
DATA : I_VBKOK LIKE VBKOK. "Delivery header
DATA : I_VBPOK LIKE VBPOK OCCURS 0 WITH HEADER LINE. "Delivery Picking
DATA : v_error.
I_VBKOK-VBELN_VL = '0080708001'.
I_VBKOK-WABUC = 'X'. "Post Good Issue Automatic
I_VBPOK-VBELN_VL = I_VBKOK-VBELN_VL. "Delivery NO
I_VBPOK-POSNR_VL = '900001'. "Delivery Item
I_VBPOK-VBELN = '10664708'. "Sales Order "You must assign Sales order & Item number
I_VBPOK-POSNN = '10'. "Sales Order item
I_VBPOK-MATNR = '6208627'.
I_VBPOK-CHARG = 'S002'.
I_VBPOK-LFIMG = 1000. "Actual quantity delivered (in sales units)
I_VBPOK-LGMNG = 1000. "Actual quantity delivered in stockkeeping units
*I_VBPOK-UMVKZ = 1. "Numerator (factor) for conversion of sales quantity into SKU
*I_VBPOK-UMVKN = 1. "Denominator (divisor) for conversion of sales qty. into SKU
APPEND I_VBPOK.
I_VBPOK-VBELN_VL = I_VBKOK-VBELN_VL. "Delivery NO
I_VBPOK-POSNR_VL = '900002'. "Delivery Item
I_VBPOK-VBELN = '10664708'. "Sales Order
I_VBPOK-POSNN = '10'. "Sales Order item
I_VBPOK-MATNR = '6208627'.
I_VBPOK-CHARG = 'S002'.
I_VBPOK-LFIMG = 1000. "Actual quantity delivered (in sales units)
I_VBPOK-LGMNG = 1000. "Actual quantity delivered in stockkeeping units
*I_VBPOK-UMVKZ = 1. "Numerator (factor) for conversion of sales quantity into SKU
*I_VBPOK-UMVKN = 1. "Denominator (divisor) for conversion of sales qty. into SKU
APPEND I_VBPOK.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
VBKOK_WA = I_VBKOK
DELIVERY = I_VBKOK-VBELN_VL
UPDATE_PICKING = 'X' "Update Picking data
IMPORTING
EF_ERROR_IN_GOODS_ISSUE_0 = V_ERROR
TABLES
VBPOK_TAB = I_VBPOK.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IMPORTING
RETURN =
ENDIF.
Edited by: Chih Hung Wang on Sep 9, 2008 4:54 AM
2013 Oct 31 12:30 PM
Hi Chih,
I receive an error message "Picked quantity is larger than the quantity to be delivered". Is there something else that needs to be done? It doesn't work for me the code u've uploaded.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |