sap GN_INVOICE_CREATE含义及使用代码
时间: 2023-07-30 20:07:03 浏览: 244
`GN_INVOICE_CREATE` 是一个 SAP 函数模块,用于创建供应商发票。其输入参数包括发票数据、公司代码、供应商编码等,输出参数返回创建的发票号码、错误信息等。
以下是一个示例代码,用于调用 `GN_INVOICE_CREATE` 函数模块:
```
DATA: ls_invoice_header TYPE bapiinvh,
lt_invoice_item TYPE TABLE OF bapiinvi,
lt_invoice_tax TYPE TABLE OF bapiinvt,
ls_return TYPE bapiret2.
* 填充发票头数据
ls_invoice_header-invoicetype = 'NB'.
ls_invoice_header-companycode = '1000'.
ls_invoice_header-vendor = '1001'.
ls_invoice_header-grossamount = '100.00'.
ls_invoice_header-documentdate = sy-datum.
* 填充发票行项目数据
ls_invoice_item-item = '0001'.
ls_invoice_item-material = 'M0001'.
ls_invoice_item-quantity = '10'.
ls_invoice_item-netvalue = '100.00'.
* 填充发票税数据
ls_invoice_tax-item = '0001'.
ls_invoice_tax-taxcode = 'MWST'.
ls_invoice_tax-taxamount = '7.00'.
* 调用 GN_INVOICE_CREATE 函数模块
CALL FUNCTION 'GN_INVOICE_CREATE'
EXPORTING
invoice_header = ls_invoice_header
TABLES
invoice_item = lt_invoice_item
invoice_tax = lt_invoice_tax
return = ls_return.
IF sy-subrc <> 0.
* 处理错误情况
ENDIF.
```
在实际使用时,需要根据具体业务场景填充发票头、行项目、税等数据,并对错误情况进行处理。
阅读全文
相关推荐

















