• 函数使用十六:BAPI_GOODSMVT_CREATE


    *&---------------------------------------------------------------------*
    *& Report  ZBAPI_GOODSMVT_CREATE
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  zbapi_goodsmvt_create.
    
    DATA:gs_head TYPE bapi2017_gm_head_01,
           gv_code TYPE bapi2017_gm_code,
           gs_head_r TYPE bapi2017_gm_head_ret,
           gt_item TYPE TABLE OF bapi2017_gm_item_create,
           gw_item LIKE LINE OF gt_item,
           gt_return TYPE TABLE OF bapiret2,
           gw_return LIKE LINE OF gt_return,
           lv_line_id TYPE i.
    
    "header data
    gv_code = '01'."采购收货
    gs_head-pstng_date = sy-datum."mkpf-bldat.
    gs_head-doc_date = sy-datum."mkpf-budat.
    gs_head-pr_uname = sy-uname.
    gs_head-ref_doc_no = '4500011395'.
    
    
    "item data
    ADD 1 TO lv_line_id.
    gw_item-line_id = lv_line_id.
    gw_item-material = 'K300000'.
    gw_item-plant  = '6375'.
    
    gw_item-batch    = 'H'.
    gw_item-vendor = '0000401210'.
    gw_item-stge_loc = '4001'.
    
    gw_item-move_type  = '101'.
    gw_item-move_plant = '6375'.
    gw_item-move_stloc = '4001'.
    gw_item-po_number = '4500011395'.
    gw_item-po_item = '10'.
    
    gw_item-entry_qnt  = 2.  "结余数量.
    gw_item-entry_uom = 'PC'.
    **SELECT SINGLE meins INTO gw_item-entry_uom FROM mara WHERE matnr = s_item-zmodeno.
    APPEND gw_item TO gt_item.
    
    
    
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        goodsmvt_header  = gs_head
        goodsmvt_code    = gv_code
      IMPORTING
        goodsmvt_headret = gs_head_r
      TABLES
        goodsmvt_item    = gt_item
        return           = gt_return.  "
    IF gs_head_r-mat_doc IS NOT INITIAL.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      WRITE gs_head_r-mat_doc.
    ELSE.
      READ TABLE gt_return INTO gw_return WITH KEY type = 'E'.
      IF sy-subrc = 0.
        WRITE: gw_return-message.
      ENDIF.
    ENDIF.
    .
    ^_^很多人都把资料锁进了note里,以后还怎么百度呢^_^
  • 相关阅读:
    Spring(四)
    安卓学习25(BaseAdapter优化)
    安卓学习24(Adapter)
    每周总结(4.4)
    安卓学习23(Date & Time组件)
    安卓学习22(Date & Time组件)
    安卓学习21(ScrollView(滚动条))
    安卓学习20(RatingBar(星级评分条))
    每周总结(3.28)
    安卓学习19(SeekBar(拖动条))
  • 原文地址:https://www.cnblogs.com/sapSB/p/15497486.html
Copyright © 2020-2023  润新知