2016 Sep 14 7:38 AM
Hi Experts,
I am using BAPI_PO_CREATE1 to POs for open PRs, and after creting POs i am using Bapi commit as well and also Wait stmt is used for 5 sconds. After that i am trying create delivery for the created PO just now. BAPI_OUTB_DELIVERY_CREATE_STO is used for creating the Delivery, but i am getting error saying that PO is already delivered or PO is not for delivery relevant. But when i use BAPI is directly using SE37 and able to create Delivery. Please help.
Warm regards,
Rajesh
Hi Experts,
I am using BAPI_PO_CREATE1 to POs for open PRs, and after creting POs i am using Bapi commit as well and also Wait stmt is used for 5 sconds. After that i am trying create delivery for the created PO just now. BAPI_OUTB_DELIVERY_CREATE_STO is used for creating the Delivery, but i am getting error saying that PO is already delivered or PO is not for delivery relevant. But when i use BAPI is directly using SE37 and able to create Delivery. Please help.
Warm regards,
Rajesh
2016 Sep 14 1:09 PM
If SE37 works and your program does not, the first step would be to check if all the relevant fields are properly sent through their conversion exits. Your delivery number for example will have to padded with zeros in front.
2016 Sep 14 1:40 PM
In addition to the above reply, you can check the type of PO created.
Thanks,
Sowbhagya
2016 Sep 14 6:40 PM
i have used CONVERSION_EXIT_ALPHA_INPUT for the PO created and passed the same to to Bapi, but getting same error. "Order item XXX already delivered or not delivery relevant " Message ID V50R no 062".
2016 Sep 15 12:50 PM
All the relevant fields need to be zero padded correctly, including the item, material, etc.
2016 Sep 16 9:58 AM
i checked and found that some Delivery no is created and showed in the import parameters on BAPI when i execute directly from SE37 but not updated in concern PO with PO History tab. That means its also not directly executing SE37 also not working i guess. If its true then what could be missing in the PO or some other ? Pl advise
2016 Sep 16 5:04 PM
You have to use BAPI_TRANSACTION_COMMIT after the first call for the data to be written to the database.
2016 Sep 17 3:00 AM
below is the code.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = wa_poheader
poheaderx = wa_poheaderx
IMPORTING
exppurchaseorder = lv_po
TABLES
return = it_return
poitem = it_poitem
poitemx = it_poitemx.
READ TABLE it_return WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
lv_po_message = wa_return-message.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_wait.
CLEAR : it_return,it_poitem,it_poitemx.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_po
IMPORTING
output = wa_stock_item-ref_doc.
SELECT SINGLE * FROM ekpv INTO wa_ekpv
WHERE ebeln = lv_po.
* wa_stock_item-ref_doc = lv_po.
wa_stock_item-ref_item = wa_ekpv-ebelp .
APPEND wa_stock_item-ref_doc TO it_stock_item.
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_STO'
EXPORTING
ship_point = wa_ekpv-vstel
IMPORTING
delivery = lv_delno
TABLES
stock_trans_items = it_stock_item
return = it_return.
READ TABLE it_return WITH KEY type = 'E' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
lv_del_message = wa_return-message.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_wait.
2016 Sep 19 3:41 PM
Re-reading this, it looks like you are saying that the BAPI call is now working and you have a delivery created. But, this delivery that is created is not showing up in the document flow. Is this correct? Or, is the delivery not actually created still, did you check the delivery tables or VL03n?
If it is still failing, did you check what is actually in the it_return in the debugger? If you are still testing in SE37, did you set up a Test Sequence to run the BAPI_TRANSACTION_COMMIT after the BAPI_OUTB_DELIVERY_CREATE_STO?
2016 Sep 17 3:01 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |