Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module for create outbound delivery

Former Member
0 Likes
2,389

Hi,

Can any one pls tell me the BAPI function module name for create outbound delivery with order reference.

Regards,

Mahi

1 ACCEPTED SOLUTION
Read only

varma_narayana
Active Contributor
0 Likes
962

Hi

This is the BAPI for creating Delivery with Sales Order Reference.

You can use the BAPI <b>BAPI_DELIVERYPROCESSING_EXEC</b>

Check this sample code..

PARAMETERS: p_vbeln LIKE vbak-vbeln.

DATA: BEGIN OF t_vbap OCCURS 0,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

kwmeng 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 kwmeng matnr werks

INTO TABLE t_vbap

FROM vbap

WHERE vbeln = p_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-kwmeng.

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.

READ TABLE t_created INDEX 1.

Write: / t_created-document_numb.

REWARD IF HELPFUL.

4 REPLIES 4
Read only

varma_narayana
Active Contributor
0 Likes
962

Hi ..

The BAPI for Outbound Delivery is :

BAPI_OUTB_DELIVERY_SAVEREPLICA

<b>Reward if Helpful.</b>

Read only

0 Likes
962

BAPI_OUTB_DELIVERY_CREATE_SLS

Read only

varma_narayana
Active Contributor
0 Likes
963

Hi

This is the BAPI for creating Delivery with Sales Order Reference.

You can use the BAPI <b>BAPI_DELIVERYPROCESSING_EXEC</b>

Check this sample code..

PARAMETERS: p_vbeln LIKE vbak-vbeln.

DATA: BEGIN OF t_vbap OCCURS 0,

vbeln LIKE vbap-vbeln,

posnr LIKE vbap-posnr,

kwmeng 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 kwmeng matnr werks

INTO TABLE t_vbap

FROM vbap

WHERE vbeln = p_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-kwmeng.

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.

READ TABLE t_created INDEX 1.

Write: / t_created-document_numb.

REWARD IF HELPFUL.

Read only

0 Likes
962

Hi varma,

thanks u r rly my problem is solved.

mahi