BAPI函数:BAPI_GOODSMVT_CANCEL的使用

MBST冲销采购订单收货凭证BAPI函数的使用

此函数对应的PO订单仅是采购合同的收货物料凭证的冲销,未涉及会计凭证与发票凭证,涉及会计凭证与发票凭证的情况在冲销前需要对凭证进行检查,后续会进行相关内容的补充。
以下是一个PEFORM 例子,仅供参考:

FORM frm_good_cancle USING  p_mblnr    TYPE mblnr
                          new_mblnr TYPE mblnr
                          u_date    TYPE sy-datum.
  DATA: li_goodsmvt_headret    TYPE bapi2017_gm_head_ret,
        li_goodsmvt_matdocitem TYPE TABLE OF bapi2017_gm_item_04 WITH HEADER LINE.
  DATA: i_return TYPE TABLE OF bapiret2 WITH HEADER LINE.

  CALL FUNCTION 'BAPI_GOODSMVT_CANCEL'
    EXPORTING
      materialdocument    = p_mblnr        "物料凭证
      matdocumentyear     = u_date(4)    "年
      goodsmvt_pstng_date = u_date
      goodsmvt_pr_uname   = sy-uname
    IMPORTING
      goodsmvt_headret    = li_goodsmvt_headret
    TABLES
      return              = i_return
      goodsmvt_matdocitem = li_goodsmvt_matdocitem.

  new_mblnr = li_goodsmvt_headret-mat_doc. "新生成的凭证

  LOOP AT i_return WHERE type = ‘e’.
  ENDLOOP.

  IF sy-subrc = 0.
  ENDIF.

ENDFORM.

你可能感兴趣的:(BAPI函数:BAPI_GOODSMVT_CANCEL的使用)