函数使用二:采购申请BAPI_PR_CREATE

REPORT YTEST01.

***************************采购申请创建*****************************begin
DATA:LV_BANFN TYPE EBAN-BANFN .
DATA:LV_BNFPO TYPE EBAN-BNFPO .
DATA:GW_PRITEM TYPE BAPIMEREQITEMIMP .
DATA:GW_PRITEMX TYPE BAPIMEREQITEMX .
DATA:GT_PRITEM TYPE TABLE OF BAPIMEREQITEMIMP .
DATA:GT_PRITEMX TYPE TABLE OF BAPIMEREQITEMX .
DATA:GW_HEAD TYPE BAPIMEREQHEADER .
DATA:GW_HEADX TYPE BAPIMEREQHEADERX.
DATA:GT_BAPIRETURN TYPE TABLE OF BAPIRET2 . GW_HEAD-PR_TYPE = ''."订单类型
GW_HEADX-PR_TYPE = 'X' . LV_BNFPO = LV_BNFPO + ."项目号
GW_PRITEM-PREQ_ITEM = LV_BNFPO .
GW_PRITEM-PREQ_NAME = SY-UNAME.
GW_PRITEM-TRACKINGNO = 'TRACKNO'.
GW_PRITEM-MATERIAL = ''.
GW_PRITEM-PLANT = ''.
GW_PRITEM-QUANTITY = .
GW_PRITEM-DELIV_DATE = SY-DATUM.
GW_PRITEM-FIXED = 'X' .
GW_PRITEM-PUR_GROUP = 'A03'.
APPEND GW_PRITEM TO GT_PRITEM . GW_PRITEMX-PREQ_ITEM = LV_BNFPO .
GW_PRITEMX-MATERIAL = 'X'.
GW_PRITEMX-PLANT = 'X'.
GW_PRITEMX-QUANTITY = 'X'.
GW_PRITEMX-DELIV_DATE = 'X'.
GW_PRITEMX-FIXED = 'X' .
GW_PRITEMX-PREQ_NAME = 'X'.
GW_PRITEMX-TRACKINGNO = 'X' .
IF GW_PRITEM-PUR_GROUP <> '' .
GW_PRITEMX-PUR_GROUP = 'X'.
ENDIF .
APPEND GW_PRITEMX TO GT_PRITEMX . CALL FUNCTION 'BAPI_PR_CREATE'
EXPORTING
PRHEADER = GW_HEAD
PRHEADERX = GW_HEADX
IMPORTING
NUMBER = LV_BANFN
TABLES
RETURN = GT_BAPIRETURN
PRITEM = GT_PRITEM
PRITEMX = GT_PRITEMX.
IF LV_BANFN IS NOT INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
WRITE:LV_BANFN.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF. ***************************采购申请创建*****************************end

审批:BAPI_REQUISITION_RELEASE

反审:BAPI_REQUISITION_RESET_RELEASE

单号+项目号+批准标识

上一篇:Java -- 异常的捕获及处理 -- throws与throw关键字


下一篇:小程序开发总结一:mpvue框架及与小程序原生的混搭开发