创建发票:MIRO
对应BAPI: BAPI_INCOMINGINVOICE_CREATE
预制发票:MIR7
对应BAPI: BAPI_INCOMINGINVOICE_PARK
两个BAPI传入参数高度类似
“业务处理” 4种类型
1 发票 Park as Invoice
2 贷方凭证 Park as Credi Memo
3 后续借记 Park as Subsequent Debit
4 后续贷记 Park as Subsequent Credit
此处已BAPI: BAPI_INCOMINGINVOICE_PARK为例
4中类型的“业务处理”通过排列两个参数的排列组合实现
"Park as Invoice: headerdata-invoice_ind = 'X' itemdata-de_cre_ind = space
"Park as Credi Memo: headerdata-invoice_ind = space itemdata-de_cre_ind = space
"Park as Subsequent Debit: headerdata-invoice_ind = 'X' itemdata-de_cre_ind = 'X'
"Park as Subsequent Credit:headerdata-invoice_ind = space itemdata-de_cre_ind = 'X'
注意1:headerdata中的参数(业务处理)inv_tran不需要赋值(1、2、3、4)否则会报错
如果针对PO预制发票或发票时维护参数itemdata和taxdata
如果直接针对料号预制发票或发票时维护参数materialdata和taxdata
注意2:itemdata中参数BUZEI必须按照升序排列,否则可能出现行数据丢失情况
CALL FUNCTION 'BAPI_INCOMINGINVOICE_PARK'
EXPORTING
headerdata = ls_headerdata
* ADDRESSDATA =
IMPORTING
invoicedocnumber = lv_invoicedocnumber
fiscalyear = lv_fiscalyear
TABLES
itemdata = lt_itemdata
* ACCOUNTINGDATA =
* GLACCOUNTDATA =
* materialdata = lt_materialdata
taxdata = lt_taxdata
* WITHTAXDATA =
* VENDORITEMSPLITDATA =
return = lt_return
* EXTENSIONIN =
* TM_ITEMDATA =
* NFMETALLITMS =
.
CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
headerdata = ls_headerdata
* ADDRESSDATA =
IMPORTING
invoicedocnumber = lv_invoicedocnumber
fiscalyear = lv_fiscalyear
TABLES
itemdata = lt_itemdata
* ACCOUNTINGDATA =
* GLACCOUNTDATA =
* materialdata = lt_materialdata
taxdata = lt_taxdata
* WITHTAXDATA =
* VENDORITEMSPLITDATA =
return = lt_return
* EXTENSIONIN =
* TM_ITEMDATA =
* NFMETALLITMS =
.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/17890.html