Functionality A delivery is created for a stock transport order or for individualstock transport order items. A delivery split can mean that severaldeliveries are created. With the exception of the stock transport order number in at least oneentry of the STOCK_TRANS_ITEMS parameter, all parameters are optional. Interface Parameter ,, Opt. ,, ,, Description Import> ,, ,, ,, SHIP_POINT ,, X ,, ,, Shipping point DUE_DATE ,, X ,, ,, Delivery creation date DEBUG_FLG ,, X ,, ,, Forces termination (ALEanalysis) Export> ,, ,, ,, DELIVERY ,, X ,, ,, First generated delivery NUM_DELIVERIES ,, X ,, ,, Number of generated deliveries Tables> ,, ,, Direction> ,, STOCK_TRANS_ITEMS ,, ,, Import ,, Order items/order number (STO) SERIAL_NUMBERS ,, X ,, Import ,, Serial numbers EXTENSION_IN ,, X ,, Import ,, Additional input data DELIVERIES ,, X ,, Export ,, Generated deliveries CREATED_ITEMS ,, X ,, Export ,, Generated delivery items EXTENSION_OUT ,, X ,, Export ,, Additional output data RETURN ,, X ,, Export ,, Error log Opt.>: Optional Direction>: Shows the direction used for table parameters. The exported table parameters are initialized before processing. This deletes any data that was in these parameters before the BAPI wascalled.Imported parameters> Shipping point> (SHIP_POINT) If the shipping point is not specified, the first shipping point thatcan be determined among the referenced purchase order items is selected. Delivery creation date> (DUE_DATE) The delivery creation date selected is December 12 9999, unlessspecified otherwise. DEBUG_FLG> For internal use only. The DEBUG_FLG can be used in ALE inboundprocessing to force a termination, thereby making the analysis of theprocess easier. Stock transport order> (STOCK_TRANS_ITEMS-REF_DOC) Unless specified otherwise, the entire order is delivered. This meansthat it is not necessary to list all the order items. It is sufficientto specify the order number of the STO. Stock transport order item> (STOCK_TRANS_ITEMS-REF_ITEM) The order item must be specified if one of the following applies:
- Not all order items in the order are to be delivered
- You want to specify delivery quantities
- Order items are to be delivered in different deliveries (external number
assignment) Caution>:
- An order item must not occur more than once in STOCK_TRANS_ITEMS.
- An order item must not occur if the order number occurs on its own in
another entry. Delivery quantities> (STOCK_TRANS_ITEMS-LFIMG) If no delivery quantities are specified, the delivery creation date isused to determine the delivery quantities from the schedule lines.Otherwise, the delivery quantity is copied from the original quantity. If the delivery quantity is specified, the sales unit must be specified,either as an SAP code (SALES_UNIT) or an ISO code (SALES_UNIT_ISO). Delivery quantities can only be specified for individual order items. External delivery number> (STOCK_TRANS_ITEMS-DELIV_NUMB) A delivery number from the external number range interval can be specified. Serial numbers> (SERIAL_NUMBERS) In Parameter SERIAL_NUMBERS, serial numbers can be assigned to thedelivery items that supply the specified order items. Additional import data> (EXTENSION_IN) In Parameter EXTENSION_IN, additional data can be transferred. For moreinformation, see the documentation for BAdI BADI_DLV_CREATE_STO_EXTIN.Exported parameters Delivery number> (DELIVERY) Generated delivery (key field in BOR object type LIKP). In case of adelivery split, this is the first generated delivery. Number of generated deliveries> (NUM_DELIVERIES) In case of a delivery split, more than one delivery may be generated. Generated deliveries> (DELIVERIES) List of all generated deliveries (including DELIVERY). Generated delivery items> (CREATED_ITEMS) List of all generated delivery items. Additional export data> (EXTENSION_OUT) In case of a synchronous call, additional data can be returned to thecaller after delivery creation, in parameter EXTENSION_OUT. See thedocumentation for BAdI BADI_DLV_CREATE_EXTOUT. Error log> (RETURN) Parameter RETURN contains the error log. In the same way as intransaction VL10, deliveries may be created even if there were errormessages during processing. Since an asynchronous caller of the BAPI(ALE) only learns of the success of processing via the RETURN parameter,error messages are converted to warning messages if at least onedelivery could be created. If a delivery is created successfully withconverted error messages, message VLBAPI061 (see below) is output. In addition, RETURN contains the following important messages: Message ,, Description BAPI000 ,, A delivery could be created BAPI001 ,, A delivery could not be created VLBAPI061 ,, Delivery created with errors (see warning messages) VL311 ,, Delivery has been saved Thus, in case of an asynchronous call, the VL311 messages tell you whichdeliveries could be created.Transactional Behavior
- No COMMIT WORK.
- ROLLBACK WORK, if no delivery could be created.
Example The following report delivers a stock transport order. report zz_test_create_sto.> parameters: vbeln like ekko-ebeln OBLIGATORY memory id bes,> vstel like tvst-vstel,> logsys like tbdls-logsys default 'NONE'.> data: lf_vbeln type vbeln_vl,> lf_num type vbnum,> ls_deli type bapishpdelivnumb,> lt_deli type table of bapishpdelivnumb,> lt_order type table of bapidlvreftosto,> ls_order type bapidlvreftosto,> ls_itm type bapidlvitemcreated,> lt_itm type table of bapidlvitemcreated,> ls_ext type bapiparex,> lt_extin type table of bapiparex,> lt_extout type table of bapiparex,> ls_ret type bapiret2,> lt_return type table of bapiret2.> * StockTransItems (here: complete STO)> ls_order-ref_doc = vbeln.> append ls_order to lt_order.> * ExtensionIn> ls_ext = 'My additional input'.> append ls_ext to lt_extin.> * Synchronous RFC> call function 'BAPI_OUTB_DELIVERY_CREATE_STO'> DESTINATION logsys> EXPORTING> SHIP_POINT = vstel> * DUE_DATE => * DEBUG_FLG => importing> delivery = lf_vbeln> num_deliveries = lf_num> tables> stock_trans_items = lt_order> extension_in = lt_extin> deliveries = lt_deli> created_items = lt_itm> extension_out = lt_extout> return = lt_return> .> write: / 'Delivery:', lf_vbeln,> / 'NumDeliveries:', lf_num,> / 'Deliveries:'.> loop at lt_deli into ls_deli.> write ls_deli-deliv_numb.> endloop.> if not lt_itm[] is initial.> write: / 'CreatedItems:'.> loop at lt_itm into ls_itm.> write: / ls_itm-ref_doc,> ls_itm-ref_item,> ls_itm-deliv_numb,> ls_itm-deliv_item,> ls_itm-material,> ls_itm-dlv_qty,> ls_itm-sales_unit,> ls_itm-sales_unit_iso.> endloop.> endif.> if not lt_return[] is initial.> write: / 'Return:'.> loop at lt_return into ls_ret.> write: / ls_ret-type, ls_ret-id, ls_ret-number,> ls_ret-message,> /.> endloop.> endif.> if not lt_extout[] is initial.> write: / 'ExtensionOut:'.> loop at lt_extout into ls_ext.> write: / ls_ext.> endloop.> endif.> * COMMIT WORK> if not lf_vbeln is initial.> commit work.> endif.>Notes
- This BAPI can deliver several orders simultaneously, but is not designed
for mass delivery.
- The BAPI cannot be called multiple times in one logical unit of work
(LUW). After a successful call, a COMMIT WORK is required of the callerbefore this BAPI or another BAPI of function group V50I can be called.
- The BAPI cannot specify delivery item numbers.
Further information
- Documentation for parameter STOCK_TRANS_ITEMS.
- Documentation for the BAdIs:
BADI_DLV_CREATE_STO_EXTIN BADI_DLV_CREATE_EXTOUTDescription Delivery number. If more than one delivery is created due to a delivery split, the firstdelivery number is returned. Description Number of deliveries generated. Value range 0, 1: ,, No deliveries generated, one delivery generated > 1: ,, More than one delivery generated due to delivery split Description The value 'X' forces processing to terminate for debugging purposes,particularly for ALE inbound processing. Description Delivery creation date for selection of due scheduling lines. Default December 31 9999 Description Shipping point. Default If no shipping point is transferred, the first shipping point that canbe determined is selected. Description CREATED_ITEMS contains all the generated delivery items. Description DELIVERIES contains all the generated delivery numbers. Description In parameter EXTENSION_IN, you can transfer additional data. This data can be processed with the following BAdI: Enhancement spot: ,, ES_SAPVL50I_BADI BADI definition: ,, BADI_DLV_CREATE_STO_EXTIN Method: ,, ADDITIONAL_INPUT Description In parameter EXTENSION_OUT, you can return additional data to asynchronous caller. The following BAdI is available for doing this: Enhancement spot: ,, ES_SAPVL50I_BADI BADI definition: ,, BADI_DLV_CREATE_EXTOUT Method: ,, ADDITIONAL_OUTPUT Description Contains the messages that were triggered during processing. Delivery created> If a delivery could be created, RETURN contains message BAPI 000:> "OutboundDelivery has been created. Externalreference: >". No delivery created> If no delivery could be created, RETURN contains message BAPI 001: > "No instance of object type OutboundDelivery has been created.External reference: >". > is only filled if a delivery numberwas transferred by the caller. In this case, >and > are the same. Otherwise, > is initial. Delivery created with errors> In case of success (BAPI000), any error messages that occurred areoutput as warning messages. This is necessary to ensure that the IDocstatus is set to "successful" (53) by ALE in case of an asynchronouscall. If error messages have been converted to warning messages in this way,RETURN contains message VLBAPI 061>: "Delivery created with errors (see warningmessages)>".Description Serial numbers with reference to stock transport order items. A serial number is assigned to the delivery item that refers to thespecified stock transport order item. Description Parameter STOCK_TRANS_ITEMS contains the stock transport order items tobe delivered. Overview> Field ,, Optional ,, Description REF_DOC ,, ,, Stock transport order REF_ITEM ,, X ,, Stock transport order item DLV_QTY ,, X ,, Delivery quantity SALES_UNIT ,, X ,, Sales unit SALES_UNIT_ISO ,, X ,, Sales unit (ISO) DELIV_NUMB ,, X ,, External delivery number If all the order items are to be delivered, it is sufficient to specifythe order number in one entry of the table parameter. The deliveryquantities are then determined from the schedule lines and the deliverycreation date. If you want to specify delivery quantities or deliver only specificorder items, the order item must be specified. You must specify the sales unit in field SALES_UNIT or SALES_UNIT_ISO,if a delivery quantity is specified. In field DELIV_NUMB, you can specify a delivery number from the externalnumber range interval. Restrictions>
- An order item can be referenced only once in this table parameter.
- If the entire order has already been referenced, by entering the order
number on its own, individual order items can no longer be listed inother entries of the table parameter.
- A delivery split for an order item cannot be forced by entering
different delivery numbers. &EXAMPLES&> Deliver all order items> REF_DOC ,, REF_ITEM ,, DLV_QTY ,, SALES_UNIT 4711 Deliver individual order items and calculate delivery quantities> REF_DOC ,, REF_ITEM ,, DLV_QTY ,, SALES_UNIT 4711 ,, 10 Deliver individual order items and specify delivery quantities> REF_DOC ,, REF_ITEM ,, DLV_QTY ,, SALES_UNIT 4711 ,, 10 ,, 2 ,, ST Combination of the cases above for different order numbers and/ororder items> REF_DOC ,, REF_ITEM ,, DLV_QTY ,, SALES_UNIT 4711 4712 ,, 10 4712 ,, 20 ,, 2 ,, ST However, the following examples are not allowed>: Specify an order item if the entire order has already been specified > REF_DOC ,, REF_ITEM ,, DLV_QTY ,, SALES_UNIT 4711 4711 ,, 10 4711 ,, 20 ,, 2 ,, ST Specify an order item multiple times> REF_DOC ,, REF_ITEM ,, DLV_QTY ,, SALES_UNIT ,, DELIV_NUMB 4711 ,, 10 ,, 1 ,, ST ,, 80001 4711 ,, 10 ,, 1 ,, ST ,, 80002
|