本文主要是介绍SAP WS_DELIVERY_UPDATE2更细库存地点LGORT及过账,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
WS_DELIVERY_UPDATE2正常情况无法更改LGORT,但是有标准的BADI可以进行变更,这样DN变更和过账可以使用一个BAPI来完成。
增强点:LE_SHP_DELIVERY_UPDATE
方法:IF_EX_LE_SHP_DELIVERY_UPDATE~UPDATE_ITEM
METHOD if_ex_le_shp_delivery_update~update_item.IF is_vbpok-lgort IS NOT INITIAL.cs_lips-lgort = is_vbpok-lgort.ENDIF.ENDMETHOD.
测试demo:
REPORT zprtest_dn_post.DATA:ls_vbkok_wa TYPE vbkok,lv_delivery TYPE likp-vbeln,lt_prot TYPE STANDARD TABLE OF prott,lt_vbpok TYPE STANDARD TABLE OF vbpok,ls_vbpok TYPE vbpok,ls_prot TYPE prott.DATA:lv_msg TYPE string.DATA:lv_vbeln TYPE vbeln VALUE '0070005866'.SELECT vbeln,posnr,vgbel,vgpos,matnr,lfimg,charg,vrkme,meins,umvkz,umvkn,lgortINTO TABLE @DATA(lt_lips)FROM lipsWHERE vbeln = @lv_vbeln.ls_vbkok_wa-vbeln_vl = lv_vbeln.
ls_vbkok_wa-wadat_ist = sy-datlo.
ls_vbkok_wa-wabuc = abap_true.
ls_vbkok_wa-komue = abap_true.lv_delivery = lv_vbeln.LOOP AT lt_lips INTO DATA(ls_lips).ls_vbpok-vbeln_vl = ls_lips-vbeln.ls_vbpok-posnr_vl = ls_lips-posnr.ls_vbpok-vbeln = ls_lips-vgbel.ls_vbpok-posnn = ls_lips-vgpos.ls_vbpok-pikmg = ls_lips-lfimg.ls_vbpok-matnr = ls_lips-matnr.ls_vbpok-charg = ls_lips-charg.ls_vbpok-vrkme = ls_lips-vrkme.ls_vbpok-meins = ls_lips-meins.ls_vbpok-umvkz = ls_lips-umvkz.ls_vbpok-umvkn = ls_lips-umvkn.ls_vbpok-lgort = '9999'.APPEND ls_vbpok TO lt_vbpok.CLEAR ls_vbpok.
ENDLOOP.CALL FUNCTION 'WS_DELIVERY_UPDATE_2'EXPORTINGvbkok_wa = ls_vbkok_wa
* SYNCHRON = ' '
* NO_MESSAGES_UPDATE_1 = ' '
* COMMIT = ' 'delivery = lv_deliveryupdate_picking = abap_trueTABLESvbpok_tab = lt_vbpokprot = lt_prot.IF lt_prot IS NOT INITIAL.LOOP AT lt_prot INTO ls_prot WHERE msgty = 'E'.MESSAGE ID ls_prot-msgidTYPE ls_prot-msgtyNUMBER ls_prot-msgnoWITH ls_prot-msgv1ls_prot-msgv2ls_prot-msgv3ls_prot-msgv4INTO DATA(lv_message).WRITE:/,lv_message.ENDLOOP.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.* cl_demo_output=>display( lt_prot ).
ELSE.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.MESSAGE 'Change and Post Successful..' TYPE 'S'.
ENDIF.
这篇关于SAP WS_DELIVERY_UPDATE2更细库存地点LGORT及过账的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!