SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Generates Delivery for Customer Order



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Wed Nov 14, 2007 4:06 pm    Post subject: Generates Delivery for Customer Order Reply with quote

BAPI_OUTB_DELIVERY_CREATE_SLS - Generates Delivery for Customer Order

A delivery is created for a sales order or for individual sales order items. A delivery split can mean that several deliveries are created. With the exception of the sales order number in at least one entry of the SALES_ORDER_ITEMS parameter, all parameters are optional.

Code:

* Populating the item data
lx_sales_item-ref_doc = l_vbeln.
lx_sales_item-ref_item = c_000010.
lx_sales_item-dlv_qty = fp_l_quantity.
lx_sales_item-sales_unit = fp_afpo-meins.

APPEND lx_sales_item TO li_sales_item.

* Function Module to create delivery
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_SLS'
EXPORTING
ship_point = l_vstel
IMPORTING
delivery = fp_l_delivery
TABLES
sales_order_items = li_sales_item
return = li_return1.


IF fp_l_delivery IS INITIAL.
* Error message Delivery not created
MESSAGE e049
ENDIF.


lx_vbkok-vbeln_vl = fp_l_delivery.
lx_vbkok-vbtyp_vl = c_vbtype_j .
lx_vbkok-vbeln = fp_l_delivery.
lx_vbkok-wabuc = c_wabuc_x.

lx_vbpok-vbeln_vl = fp_l_delivery.
lx_vbpok-posnr_vl = c_posnr.
lx_vbpok-vbeln = fp_l_delivery.
lx_vbpok-posnn = c_posnr.
lx_vbpok-matnr = fp_afpo-matnr.
lx_vbpok-charg = fp_afpo-charg.
lx_vbpok-werks = fp_afpo-dwerk.
lx_vbpok-taqui = c_wabuc_x.
lx_vbpok-pikmg = fp_l_quantity.
APPEND lx_vbpok TO li_vbpok.

* Clearing the implicit lock that mb_create_goods_mvt has. That
* prevents it from bieng called more then once within same LUW.
PERFORM clear_xcommit IN PROGRAM saplmbwl.

* FM to perform picking,confirmation W-M status and PGI.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = lx_vbkok
synchron = c_xfeld_x
delivery = fp_l_delivery
update_picking = c_xfeld_x
nicht_sperren = c_no_sp_x
if_database_update = c_data_1
if_error_messages_send_0 = c_xfeld_x
TABLES
vbpok_tab = li_vbpok
prot = li_prott.
* Checking if any error in PGI
READ TABLE li_prott WITH KEY MSGTY = c_e TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
MESSAGE e046 WITH fp_l_delivery.
ENDIF.
READ TABLE li_prott WITH KEY MSGTY = c_a TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
MESSAGE e046 WITH fp_l_delivery.
ENDIF.


Code:
REPORT Y1042.
DATAELIVERY TYPE BAPISHPDELIVNUMB-DELIV_NUMB,
NUM_DELIVERIES TYPE BAPIDLVCREATEHEADER-NUM_DELIVERIES,
SALES_ORDER_ITEMS LIKE BAPIDLVREFTOSALESORDER OCCURS 0 WITH HEADER LINE,
RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE .

START-OF-SELECTION.
SALES_ORDER_ITEMS-REF_DOC = '0000000193'.
SALES_ORDER_ITEMS-REF_ITEM = '000010'.
SALES_ORDER_ITEMS-DLV_QTY = 1.
SALES_ORDER_ITEMS-SALES_UNIT = 'EA'.
APPEND SALES_ORDER_ITEMS.
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_SLS'
* EXPORTING
* SHIP_POINT =
* DUE_DATE =
* DEBUG_FLG =
IMPORTING
DELIVERY = DELIVERY
NUM_DELIVERIES = NUM_DELIVERIES
TABLES
SALES_ORDER_ITEMS = SALES_ORDER_ITEMS
* SERIAL_NUMBERS =
* EXTENSION_IN =
* DELIVERIES =
* CREATED_ITEMS =
* EXTENSION_OUT =
RETURN = RETURN
.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SD All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.