cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with BAPI_INCOMINGINVOICE_CREATE : FI DOCUMENT at MIRO

0 Kudos
2,711

Hello SAP experts,
I'm using BAPI_INCOMINGINVOICE_CREATE to create an invoice with reference to Purchase Order. We are facing below issues.

When trying to create an invoice with below code, There is no error but invoice number is not getting generated.

Code:

* Header
WA_HEADER-INVOICE_IND = 'X'.
WA_HEADER-DOC_TYPE = 'RE'.
WA_HEADER-DOC_DATE = SY-DATUM. "Document date
WA_HEADER-PSTNG_DATE = SY-DATUM. "Posting date
WA_HEADER-REF_DOC_NO = 'Test'. "Ref doc. No.
WA_HEADER-COMP_CODE = '1000'. "Company Code
WA_HEADER-GROSS_AMOUNT = '5000'. "Gross amount(aft. tax) for the invoice
WA_HEADER-CURRENCY = 'INR'. "Currency Field
WA_HEADER-INV_REC_DATE = SY-DATUM.
WA_HEADER-PMNTTRMS = 'Z005'.
WA_HEADER-BUS_AREA = 'B401'.
WA_HEADER-DIFF_INV = '0000100816'.
WA_HEADER-BUSINESS_PLACE = 'S004'.


* Item
WA_ITEM-INVOICE_DOC_ITEM = '000001'.
WA_ITEM-PO_NUMBER = '4700057078'. "PO number
WA_ITEM-PO_ITEM = '00010'. "PO item number
WA_ITEM-REF_DOC = '5000720172'. "GR number
WA_ITEM-REF_DOC_YEAR = '2021'. "GR fiscal year
WA_ITEM-REF_DOC_IT = '0001'. "GR item number
WA_ITEM-TAX_CODE = 'II'. "Tax code applicable
WA_ITEM-ITEM_AMOUNT = '5000'. "Item amount
WA_ITEM-QUANTITY = '50'. "Invoice quantity
WA_ITEM-PO_UNIT = 'KG'. "UoM
WA_ITEM-PO_UNIT_ISO = 'KGM'. "UoM
WA_ITEM-PO_PR_QNT = '50'. "UoM
WA_ITEM-PO_PR_UOM = 'KG'. "UoM
APPEND WA_ITEM TO IT_ITEM.

***Tax data
WA_TAX-TAX_CODE = 'II'.
APPEND WA_TAX TO TAXDATA.

CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'
EXPORTING
HEADERDATA = WA_HEADER
IMPORTING
INVOICEDOCNUMBER = G_INVNO
FISCALYEAR = G_FYEAR
TABLES
ITEMDATA = IT_ITEM
TAXDATA = TAXDATA
RETURN = IT_RET.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = IT_RET.


Please help us to resolve these issues.

Regards,

vijay_hariharan
Contributor

Hello Aroon,

The issue you mention is quite open ended since there would Incoming invoice creation is configuration dependent which would be specific to your client. You may need to check with your development/ABAP team to analyze further. If there are any Error/Warning Messages that you encounter, you may mention them here(after you have already searched the forum for similar issues) and then you might get a suitable response.

Some hints maybe - please check the Documentation of the BAPI to see if there are any specific Authorizations required for Document creation OR some fields which need to be entered for specific scenarios etc.

Regards,
Vijay

akaserer
Participant
0 Kudos

Hello Aroon


You could try to execute BAPI_INCOMINGINVOICE_CREATE first in test-mode with your data.
Just use SE37 and "test/execute" BAPI_INCOMINGINVOICE_CREATE.
After that enter your test data and execute. (You can also save your testdata, so you dont have to enter the data every time).
If the data is correct and also corresponding with your customizing-settings (company-code, supplier,...) and invoice should be created.
I would test the data beforehands in MIRO to verify that the data you enter is ok.

If you dont get the expected result, you should ask an ABAP-developer to debug the BAPI.

BG Andreas

View Entire Topic
0 Kudos

Hello SAP experts,

We will require help from a Funcational or ABAP person, who already used BAPI: BAPI_INCOMING_INVOICE_CREATE for doing MIRO in Auto node or background.

Request for your suggestion or help in this regards,

Regards,