还是首先看前台:
事务代码:VL10B
点击采购订单标签页,输入装运点,采购凭证,交货创建日期计算规则默认为9,
可以就这么空着,直接点执行,会显示满足条件的凭证号
点击热点进去,找到装运点
选择一条采购订单,然后填写对应装运点后选中一行,点新建图标(这里翻译成了“后台”)
点全部
这里就生成了销售凭证
对应的BAPI:
VSTEL
LIKE TVST
-VSTEL
,
"装运点/接收点
LF_NUM
TYPE VBNUM
,
STOCK_TRANS_ITEMS
LIKE BAPIDLVREFTOSTO
OCCURS
0
WITH
HEADER
LINE
,
LF_VBELN
TYPE VBELN_VL
,
LS_DELI
TYPE BAPISHPDELIVNUMB
,
LT_DELI
TYPE
TABLE
OF BAPISHPDELIVNUMB
,
LT_EXTOUT
TYPE
TABLE
OF BAPIPAREX
,
LS_EXT
TYPE BAPIPAREX
,
LT_RETURN
TYPE
TABLE
OF BAPIRET2
,
LS_RET
TYPE BAPIRET2
,
LS_ITM
TYPE BAPIDLVITEMCREATED
,
LT_ITM
TYPE
TABLE
OF BAPIDLVITEMCREATED
.
VSTEL
=
'RYZJ'
.
"装运点
STOCK_TRANS_ITEMS
-REF_DOC
=
'2300000408'
.
"参考凭证
APPEND STOCK_TRANS_ITEMS
.
REFRESH LT_RETURN
.
CALL
FUNCTION
'BAPI_OUTB_DELIVERY_CREATE_STO'
EXPORTING
SHIP_POINT
= VSTEL
IMPORTING
DELIVERY
= LF_VBELN
NUM_DELIVERIES
= LF_NUM
TABLES
STOCK_TRANS_ITEMS
= STOCK_TRANS_ITEMS
DELIVERIES
= LT_DELI
CREATED_ITEMS
= LT_ITM
EXTENSION_OUT
= LT_EXTOUT
RETURN
= LT_RETURN
.
IF
NOT LF_VBELN
IS
INITIAL
.
CALL
FUNCTION
'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT
=
'X'
.
ENDIF.