【ABAP】更新交货单交货数量和拣配数量
生活随笔
收集整理的這篇文章主要介紹了
【ABAP】更新交货单交货数量和拣配数量
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
需求:
?
Demo:
*&---------------------------------------------------------------------* *& Report ZTEST_VL02N_DELIVERY1122 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ZTEST_VL02N_DELIVERY1122.DATA: LS_VBKOK TYPE VBKOK. DATA: LT_VBKOK TYPE STANDARD TABLE OF VBKOK. DATA: LT_PROTT TYPE STANDARD TABLE OF PROTT. DATA: LS_PROTT TYPE PROTT. DATA: LT_VBPOK TYPE STANDARD TABLE OF VBPOK. DATA: LS_VBPOK TYPE VBPOK. DATA: LV_MESSAGE TYPE STRING. DATA: LV_ALL_MESSAGE TYPE STRING. DATA: LV_FLAG TYPE CHAR01.PARAMETERS : P_VBELN TYPE LIKP-VBELN OBLIGATORY.LS_VBKOK-VBELN_VL = P_VBELN. LS_VBKOK-KOMUE = 'X'. "交貨數量 = 撿配數量 LS_VBKOK-KZKODAT = 'X'. "Picking date LS_VBKOK-KODAT = '20210808'. "Picking dateDATA : LT_LIPS LIKE TABLE OF LIPS WITH HEADER LINE. SELECT * FROM LIPS INTO TABLE LT_LIPS WHERE VBELN = P_VBELN.LOOP AT LT_LIPS.CLEAR:LS_VBPOK,LV_FLAG,LV_MESSAGE,LV_ALL_MESSAGE,LT_PROTT.LS_VBPOK-VBELN_VL = LT_LIPS-VBELN.LS_VBPOK-POSNR_VL = LT_LIPS-POSNR.LS_VBPOK-VBELN = LT_LIPS-VGBEL.LS_VBPOK-POSNN = LT_LIPS-VGPOS.LS_VBPOK-PIKMG = '4.7'.LS_VBPOK-MATNR = LT_LIPS-MATNR.LS_VBPOK-CHARG = LT_LIPS-CHARG.LS_VBPOK-VRKME = LT_LIPS-VRKME.LS_VBPOK-MEINS = LT_LIPS-MEINS.LS_VBPOK-UMVKZ = LT_LIPS-UMVKZ.LS_VBPOK-UMVKN = LT_LIPS-UMVKN.LS_VBPOK-LGORT = LT_LIPS-LGORT.APPEND LS_VBPOK TO LT_VBPOK.ENDLOOP.CALL FUNCTION 'WS_DELIVERY_UPDATE'EXPORTINGVBKOK_WA = LS_VBKOK * COMMIT = CONDELIVERY = P_VBELNUPDATE_PICKING = 'X'SYNCHRON = 'X' NICHT_SPERREN = 'X' TABLESVBPOK_TAB = LT_VBPOKPROT = LT_PROTTEXCEPTIONSERROR_MESSAGE = 1OTHERS = 2. IF SY-SUBRC = 0 .LOOP AT LT_PROTT INTO LS_PROTT WHERE MSGTY CA 'EAX'.CALL FUNCTION 'MESSAGE_TEXT_BUILD'EXPORTINGMSGID = LS_PROTT-MSGIDMSGNR = LS_PROTT-MSGNOMSGV1 = LS_PROTT-MSGV1MSGV2 = LS_PROTT-MSGV2MSGV3 = LS_PROTT-MSGV3MSGV4 = LS_PROTT-MSGV4IMPORTINGMESSAGE_TEXT_OUTPUT = LV_MESSAGE.CONCATENATE LV_ALL_MESSAGE LV_MESSAGE INTO LV_ALL_MESSAGE .LV_MESSAGE = LV_ALL_MESSAGE.LV_FLAG = 'X' .CLEAR LS_PROTT.ENDLOOP. ELSE.CLEAR LV_MESSAGE.CALL FUNCTION 'MESSAGE_TEXT_BUILD'EXPORTINGMSGID = SY-MSGIDMSGNR = SY-MSGNOMSGV1 = SY-MSGV1MSGV2 = SY-MSGV2MSGV3 = SY-MSGV3MSGV4 = SY-MSGV4IMPORTINGMESSAGE_TEXT_OUTPUT = LV_ALL_MESSAGE.LV_MESSAGE = LV_ALL_MESSAGE.LV_FLAG = 'X' . ENDIF .IF LV_FLAG IS INITIAL .CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGWAIT = 'X'.WRITE : 'OK'. ELSE.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.WRITE : LV_ALL_MESSAGE. ENDIF.函數”WS_DELIVERY_UPDATE“還是挺有用,也可以直接交貨過賬。
總結
以上是生活随笔為你收集整理的【ABAP】更新交货单交货数量和拣配数量的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【学习笔记】SAP OData服务简介
- 下一篇: 【ABAP】获取程序中的Include