SAP Function BAPI_OUTB_DELIVERY_CREATE_SLS - Generates Delivery for Customer Order

Parameter Reference Type Length Default Optional Text
DEBUG_FLG BAPIDLVCONTROL-DEBUG_FLG C 1 X Debugging Flag
DUE_DATE BAPIDLVCREATEHEADER-DUE_DATE D 8 X Delivery Creation Date
NO_DEQUEUE BAPIFLAG-BAPIFLAG C 1 ' ' X Indicator: Do Not Unlock
SHIP_POINT BAPIDLVCREATEHEADER-SHIP_POINT C 4 X Shipping Point/Receiving Point

Parameter Reference Type Length Text
DELIVERY BAPISHPDELIVNUMB-DELIV_NUMB C 10 Delivery Number
NUM_DELIVERIES BAPIDLVCREATEHEADER-NUM_DELIVERIES N 4 Number of created documents

Parameter Reference Length Optional Text
CREATED_ITEMS BAPIDLVITEMCREATED 145 X Generated Delivery Items
DELIVERIES BAPISHPDELIVNUMB 10 X Delivery Number
EXTENSION_IN BAPIPAREX 990 X Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
EXTENSION_OUT BAPIPAREX 990 X Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
RETURN BAPIRET2 548 X Return Parameter(s)
SALES_ORDER_ITEMS BAPIDLVREFTOSALESORDER 39 Delivery Item with Reference to a Sales Order
SERIAL_NUMBERS BAPIDLVSERIALNUMBER 34 X Serial Number

Functionality
A delivery is created for a sales order or for individual sales orderitems. A delivery split can mean that several deliveries are created.
With the exception of the sales order number in at least one entry ofthe SALES_ORDER_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 ,,
SALES_ORDER_ITEMS ,, ,, Import ,, Order items/order
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.
Caution:
The exported table parameters are initialized before processing. Thisdeletes 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 order items is selected. In thecase of a returns customer order, the shipping point is the goodsreceiving point for the returned goods.
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.
Order (SALES_ORDER_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.
Order item (SALES_ORDER_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 SALES_ORDER_ITEMS.

    • An order item must not occur if the order number occurs on its own in
    • another entry.
      Delivery quantities (SALES_ORDER_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 (SALES_ORDER_ITEMS-DELIV_NUMB)
      A delivery number from the external number range interval can bespecified.
      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_SLS_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 sales order without specifying theshipping point, the delivery creation date, or the delivery quantities.
        report zz_test_create_sls.
        parameters: vbeln like vbak-vbeln OBLIGATORY memory id aun,
        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 bapidlvreftosalesorder,
        ls_order type bapidlvreftosalesorder,
        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.
        * SalesOrderItems (here: complete sales order)
        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_SLS'
        DESTINATION logsys
        * EXPORTING
        * SHIP_POINT =
        * DUE_DATE =
        * DEBUG_FLG =
        importing
        delivery = lf_vbeln
        num_deliveries = lf_num
        tables
        sales_order_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 the parameters

              • Documentation for the BAdIs:

              • BADI_DLV_CREATE_SLS_EXTIN
                BADI_DLV_CREATE_EXTOUT

                Description
                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 analysis purposes,particularly for ALE inbound processing.

                Description
                Delivery creation date for selection of due scheduling lines.

                Default
                December 31 9999

                Description
                Shipping point or goods receiving point for returns for a sales order.

                Default
                If no shipping point is transferred, the first shipping point that isfound in the order items referenced in parameter SALES_ORDER_ITEMS isselected.

                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_SLS_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 occurred 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, an
                d 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 asynchronous
                If error messages have been converted to warning messages in this way,RETURN contains message VLBAPI 061:
                "Delivery created with errors (see warning message
                s)".

                Description
                The parameter SALES_ORDER_ITEMS contains the sales order items to bedelivered.
                Overview
                Field ,, Optional ,, Description
                REF_DOC ,, ,, Sales order
                REF_ITEM ,, X ,, Sales 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.
                &CONSTRAINTS&

                • 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

                    Default

                    Description
                    Serial numbers with reference to sales order items.
                    A serial number is assigned to the delivery item that refers to thespecified sales order item.

1075141BAPIs valid for usage with AFS6.0