Ansicht
Dokumentation
/SMERP/SD_DODELIVERY_SALES_CRT - BAPI Wrapper: Generates Delivery for Customer Order
SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up Addresses (Business Address Services)This documentation is copyright by SAP AG.
Functionality
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.
Interface
Parameter | Opt. | Description | |
---|---|---|---|
Import | |||
SHIP_POINT | X | Shipping point | |
DUE_DATE | X | Delivery creation date | |
DEBUG_FLG | X | Forces termination (ALE analysis) | |
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. This deletes any data that was in these parameters before the BAPI was called.
Imported parameters
Shipping point (SHIP_POINT)
If the shipping point is not specified, the first shipping
point that can be determined among the referenced order items is selected. In the case of a returns customer order, the shipping point is the goods receiving point for the returned goods.
Delivery creation date (DUE_DATE)
The delivery creation date selected is December 12 9999, unless specified otherwise.
DEBUG_FLG
For internal use only. The DEBUG_FLG can be used in ALE inbound processing to force a termination, thereby making the analysis of the process easier.
Order (SALES_ORDER_ITEMS-REF_DOC)
Unless specified otherwise, the entire order
is delivered. This means that it is not necessary to list all the order items. It is sufficient to 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)
- 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 is used 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 be specified.
Serial numbers (SERIAL_NUMBERS)
In parameter SERIAL_NUMBERS, serial numbers can be assigned to the delivery items that supply the specified order items.
Additional import data (EXTENSION_IN)
In Parameter EXTENSION_IN, additional data can be transferred. For more information, 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 a delivery 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 the caller after delivery creation, in parameter EXTENSION_OUT. See the documentation for BAdI BADI_DLV_CREATE_EXTOUT.
Error log (RETURN)
Parameter RETURN contains the error log. In the same way as
in transaction VL10, deliveries may be created even if there were error messages 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 one delivery could be created. If a delivery is created successfully with converted 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 |
Thus, in case of an asynchronous call, the VL311 messages tell you which deliveries 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 the shipping 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 caller before 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
Parameters
ES_BAPI_OUTPUTET_CREATED_ITEMS
ET_DELIVERIES
ET_EXTENSION_OUT
ET_RETURN
EV_DELIVERY
EV_NUM_DELIVERIES
IS_BAPI_INPUT
IT_EXTENSION_IN
IT_SALES_ORDER_ITEMS
IT_SERIAL_NUMBERS
IV_CREATE_TYPE
IV_DUE_DATE
IV_SHIP_POINT
Exceptions
Function Group
RP/SAPLBAPI_SD_DELIVERYAddresses (Business Address Services) TXBHW - Original Tax Base Amount in Local Currency
This documentation is copyright by SAP AG.
Length: 16475 Date: 20240603 Time: 235057 sap01-206 ( 162 ms )