zoukankan      html  css  js  c++  java
  • 委外采购单发货过账——BAPI_GOODSMVT_CREATE

    效果:

    代码:

    *&---------------------------------------------------------------------*
    *& Report ZMMRTEST
    *&---------------------------------------------------------------------*
    *&
    *&---------------------------------------------------------------------*
    REPORT ZMMRTEST.
    
    DATA: ls_goodsmvt_header TYPE bapi2017_gm_head_01,
          ls_goodsmvt_code   TYPE bapi2017_gm_code,
          l_mblnr TYPE bapi2017_gm_head_ret-mat_doc,
          l_mjahr TYPE bapi2017_gm_head_ret-doc_year,
          lt_goodsmvt_item   TYPE TABLE OF  bapi2017_gm_item_create,
          ls_goodsmvt_item TYPE bapi2017_gm_item_create,
          lt_return TYPE TABLE OF bapiret2.
    
    ls_goodsmvt_code-gm_code = '04'.
    ls_goodsmvt_header-pstng_date = '20200502'.
    ls_goodsmvt_header-doc_date = '20200502'.
    ls_goodsmvt_header-header_txt = 'TEST'.
    
    ls_goodsmvt_item-move_type = '541'.
    ls_goodsmvt_item-material   = 'CTMB0781-S2V-1'.
    ls_goodsmvt_item-entry_qnt  = 10.
    ls_goodsmvt_item-entry_uom  = 'PCS'.
    ls_goodsmvt_item-plant      = '2000'.
    ls_goodsmvt_item-stge_loc   = '2101'.
    ls_goodsmvt_item-vendor = 'VCGE0006'.
    ls_goodsmvt_item-po_number = '5700001028'.
    ls_goodsmvt_item-po_item = '00010'.
    APPEND ls_goodsmvt_item TO lt_goodsmvt_item.
    
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        goodsmvt_header  = ls_goodsmvt_header
        goodsmvt_code    = ls_goodsmvt_code
      IMPORTING
        materialdocument = l_mblnr
        matdocumentyear  = l_mjahr
      TABLES
        goodsmvt_item    = lt_goodsmvt_item
        return           = lt_return.
    
    READ TABLE lt_return INTO DATA(ls_return) WITH KEY type = 'E'.
    
    IF sy-subrc NE 0.
      COMMIT WORK.
      WRITE l_mblnr.
    ELSE.
      ROLLBACK WORK.
    ENDIF.
  • 相关阅读:
    寒武纪思元290芯片和MLU290-M5卡
    NUMA Domian和NUMA Distance
    Understanding Habana Labs's GPU
    AMD Instinct MI100-首个FP64性能超10TFLOPS的计算卡
    编程小记
    Redis二进制安全
    Redis布隆过滤器与布谷鸟过滤器
    缓存与缓存一致性协议
    CodeForces
    CodeForces
  • 原文地址:https://www.cnblogs.com/StephenAmell/p/13359717.html
Copyright © 2011-2022 走看看