06-18-2014 12:47 PM
Hi experts,
I am looking for bapi that takes sales order,shipping point and delivery creation date and generates delivery.
I have tried with bapi GN_DELIVERY_CREATE but i am not able to understand whether this bapi is used for inbound or outbound deliveries.If this bapi is ok then what are the mandatory fields for this bapi.
Regards,
Pankaj Jain
06-18-2014 1:01 PM
Hi Pankaj,
Please try to use BAPI 'BAPI_DELIVERYPROCESSING_EXEC' for creating delivery form sales order , you can pass value and create delivery.
you can refer below code, it may be helpfull for you to create delivery.
DATA: BEGIN OF t_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
zmeng LIKE vbap-kwmeng,
matnr LIKE vbap-matnr,
werks LIKE vbap-werks,
END OF t_vbap.
DATA: t_request TYPE STANDARD TABLE OF bapideliciousrequest
WITH HEADER LINE.
DATA: t_created TYPE STANDARD TABLE OF bapideliciouscreateditems
WITH HEADER LINE.
DATA: t_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
SELECT vbeln posnr zmeng matnr werks
INTO TABLE t_vbap
FROM vbap
WHERE vbeln = v_vbeln.
LOOP AT t_vbap.
t_request-document_numb = t_vbap-vbeln.
t_request-document_item = t_vbap-posnr.
t_request-quantity_sales_uom = t_vbap-zmeng.
t_request-quantity_base__uom = t_vbap-zmeng.
t_request-id = 1.
t_request-document_type = 'A'.
t_request-delivery_date = sy-datum.
t_request-material = t_vbap-matnr.
t_request-plant = t_vbap-werks.
t_request-date = sy-datum.
t_request-goods_issue_date = sy-datum.
t_request-goods_issue_time = sy-uzeit.
APPEND t_request.
ENDLOOP.
CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
TABLES
request = t_request
createditems = t_created
return = t_return.
READ TABLE t_return WITH KEY type = 'E'.
IF sy-subrc = 0.
MESSAGE e208(00) WITH 'Delivery creation error'.
ENDIF.
COMMIT WORK.
Regards,
Prasenjit
06-18-2014 1:05 PM
Hi Pankaj,
Normally BAPIs do have proper documentations specifying the mandatory fields to be passed for its execution.
But for GN_DELIVERY_CREATE I didn't see any FM documentation, may be its german written FM as it's text translate to 'Creating deliveries from general interface'.
have a look at following discussion, might be helpful.
https://scn.sap.com/thread/1075113
Regards,
Naveen
06-18-2014 1:21 PM
Thanks for quick reply Prasenjit and Naveen,i am trying your solutions
Regards,
Pankaj
06-18-2014 1:33 PM
Hi,
You can use BAPI_OUTB_DELIVERY_CREATE_SLS.
In par. SALES_ORDER_ITEMS You can put sales order number and postion.
Regards,
Jarek
06-19-2014 12:32 PM
Thanks Jaroslaw and all , problem is resolved using BAPI BAPI_DELIVERYPROCESSING_EXEC.
06-19-2014 12:37 PM