MIRO发票过账的时候
默认不能直接点物料页签
需要先维护header信息
这个时候就可以维护物料页签了
然后保存即可
业务处理类型 1:发票
如果处理类型是2 贷方凭证
对比下两者区别
MIR4
查看会计凭证
可以查看下对应表
RSEG - Document Item: Incoming invoice MM - Invoice Verification
RBKP - Document Header: invoice Receipt MM - Invoice Verification
REPORT zdemo_miro.
PARAMETERS p_s TYPE char1 RADIOBUTTON GROUP g1 DEFAULT 'X'.
PARAMETERS p_h TYPE char1 RADIOBUTTON GROUP g1.
DATA: ls_headerdata LIKE bapi_incinv_create_header,
lt_itemdata LIKE TABLE OF bapi_incinv_create_item,
ls_itemdata LIKE bapi_incinv_create_item,
lt_return LIKE TABLE OF bapiret2,
ls_return LIKE bapiret2,
lv_invoicedocnumber LIKE bapi_incinv_fld-inv_doc_no.
DATA: lv_item TYPE rblgp.
DATA: lv_gross TYPE bapi_rmwwr.
DATA:lt_materialdata LIKE TABLE OF bapi_incinv_create_material.
DATA:ls_materialdata LIKE bapi_incinv_create_material.
ls_materialdata-invoice_doc_item = 1.
ls_materialdata-material = 'XSWPTEST'.
IF p_s IS NOT INITIAL.
ls_materialdata-db_cr_ind = 'S'.
ELSE.
ls_materialdata-db_cr_ind = 'H'.
ENDIF.
ls_materialdata-item_amount = 10000.
ls_materialdata-quantity = 1.
ls_materialdata-tax_code = 'J8'.
ls_materialdata-base_uom = 'EA'.
ls_materialdata-val_area = 'S600'.
APPEND ls_materialdata TO lt_materialdata.
lv_gross = lv_gross + 10000 + 10000 * 16 / 100.
*&header
CLEAR: ls_headerdata.
* "当采购订单行项目是正常订单时该标识必为X,为miro界面上的业务处理为1.发票否则为2.
* "贷方凭证(invoice_ind='X'表示miro界面最上部的业务处理是1.发票,invoice_ind='', 表示miro界面最上部的业务处理为2.贷方凭证)
IF p_s IS NOT INITIAL.
ls_headerdata-invoice_ind = 'X'."正常发票凭证
ELSE.
ls_headerdata-invoice_ind = ''."贷项凭证
ENDIF.
ls_headerdata-gross_amount = lv_gross.
ls_headerdata-bline_date = sy-datum.
ls_headerdata-diff_inv = 'XSWEY'.
ls_headerdata-ref_doc_no = 'S600'.
ls_headerdata-doc_date = sy-datum.
ls_headerdata-pstng_date = sy-datum.
ls_headerdata-comp_code = 'S600'..
ls_headerdata-currency = 'RMB'.
ls_headerdata-currency_iso = 'RMB'.
ls_headerdata-calc_tax_ind = 'X'.
ls_headerdata-pmnttrms = '0001'.
ls_headerdata-item_text = 'text'.
ls_headerdata-gross_amount = lv_gross.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = ls_headerdata
IMPORTING
invoicedocnumber = lv_invoicedocnumber
TABLES
itemdata = lt_itemdata
materialdata = lt_materialdata
return = lt_return.
IF lv_invoicedocnumber IS NOT INITIAL .
WRITE lv_invoicedocnumber.
COMMIT WORK AND WAIT.
ENDIF.