BAPI_OUTB_DELIVERY_CREATE_STO的用法,给一下示例
时间: 2023-08-02 09:11:45 浏览: 176
BAPI操作例, 不了解的朋友可以浏览一下
BAPI_OUTB_DELIVERY_CREATE_STO是一个SAP函数模块,用于创建一个STO交货单。以下是一个简单的示例代码:
```
DATA: ls_header TYPE bapiobdlhdr,
lt_item TYPE TABLE OF bapiobdlitem,
ls_item TYPE bapiobdlitem,
lt_pack TYPE TABLE OF bapiobdlpack,
ls_pack TYPE bapiobdlpack,
lt_return TYPE TABLE OF bapiret2,
ls_return TYPE bapiret2.
* Fill the header data
ls_header-vbeln_vl = '12345678'. "Delivery document number
ls_header-werks = '1000'. "Plant
ls_header-lfart = 'ZSTO'. "Delivery type
* Fill the item data
ls_item-posnr = '000010'. "Item number
ls_item-matnr = 'ABC123'. "Material number
ls_item-werks = '1000'. "Plant
ls_item-lfimg = 10. "Delivery quantity
APPEND ls_item TO lt_item.
* Fill the package data
ls_pack-posnr = '000010'. "Item number
ls_pack-scan_st = 'X'. "Scan status
APPEND ls_pack TO lt_pack.
* Call the function module
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CREATE_STO'
EXPORTING
headerdata = ls_header
TABLES
itemdata = lt_item
packdata = lt_pack
return = lt_return.
* Check the return table for any errors
LOOP AT lt_return INTO ls_return.
IF ls_return-type = 'E' OR ls_return-type = 'A'.
MESSAGE ls_return-message TYPE 'E'.
ENDIF.
ENDLOOP.
```
在上面的示例中,我们填充了交货单的头部、行项目和包装信息,并使用函数模块BAPI_OUTB_DELIVERY_CREATE_STO创建了交货单。请注意,这只是一个简单的示例,实际应用中可能需要更多的数据和逻辑处理。
阅读全文