委外采购单发货过账——BAPI_GOODSMVT_CREATE

效果:

委外采购单发货过账——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.

 

委外采购单发货过账——BAPI_GOODSMVT_CREATE

上一篇:ORACLE 索引批量重建


下一篇:从Count看Oracle执行计划的选择