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

VL01N function Module

Former Member
0 Likes
1,391

Dear all,

I try to create delivery (transaction code vl01n) against the sales order through function module but i am not able do this.

can you help me how to creat delivary through bapi.

2 REPLIES 2
Read only

Former Member
0 Likes
803

Hi,

You can use BAPI BAPI_DELIVERYPROCESSING_EXEC. You can create delivery with reference to sales order.

The below is the sample code...

data:lt_request like bapideliciousrequest

occurs 0 with header line,

lt_createditems like bapideliciouscreateditems

occurs 0 with header line,

lt_return like bapiret2

occurs 0 with header line.

lt_request-document_type = 'A'.

lt_request-document_numb = vbeln.

lt_request-document_item = posnr.

lt_request-material = matnr.

lt_request-plant = werks.

lt_request-stge_loc = lgort.

lt_request-quantity_base__uom = base_uom_qty.

lt_request-delivery_date = sy-datum.

append lt_request.

call function 'BAPI_DELIVERYPROCESSING_EXEC'

EXPORTING

DELIVERY_EXTEND =

TECHN_CONTROL =

tables

request = lt_request

createditems = lt_createditems

return = lt_return.

loop at lt_return where type = 'A'

or type = 'E'.

exit.

endloop.

if sy-subrc 0.

Use the BAPI for Commit

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'H'.

endif.

Regards,

Satish

Read only

Former Member
0 Likes
803

hi

use this

BAPI_OUTB_DELIVERY_SAVEREPLICA

BAPI_DELIVERPROCESSING_EXEC

The below is for creating delivery for STO's.

-


Delivery creation

-


call function 'SHP_VL10_DELIVERY_CREATE'

exporting

IF_LEDAT = I_LFDAT

IF_NUR_VORGABE_POS = YES

IT_KEY_ENQUE_READ = IT_KEY_ENQUE_READ

IT_KOMDLGN = IT_KOMDLGN

changing

CX_SD_ORDER = XS_SD_ORDER

CT_VBSK_ALL = XT_VBSK_ALL

CT_VBLS = XT_VBLS

CT_KEY_LATE = XT_KEY_LATE.

reward if helpful

kushagra