函数使用二:采购申请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 = '901'."订单类型
GW_HEADX-PR_TYPE = 'X' .

LV_BNFPO  = LV_BNFPO  + 10 ."项目号
GW_PRITEM-PREQ_ITEM = LV_BNFPO .
GW_PRITEM-PREQ_NAME = SY-UNAME.
GW_PRITEM-TRACKINGNO = 'TRACKNO'.
GW_PRITEM-MATERIAL =  '000000000018007349'.
GW_PRITEM-PLANT    =  '1010'.
GW_PRITEM-QUANTITY =  10.
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

单号+项目号+批准标识

转载于:https://www.cnblogs.com/sapSB/p/6806880.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值