cancel
Showing results for 
Search instead for 
Did you mean: 

Getting accounting document number after posting using BAPI

sap_beginner01
Explorer
0 Kudos
715

Hi all,

I am using BAPI_INCOMINGINVOICE_CREATE to post an invoice against a purchase order. The BAPI returns a material document number but I want the accounting document number.

I tried using AC_DOCUMENT_RECORD but with no success. I might be passing the wrong information.

Can someone please guide me on what exactly I should enter or should I use another FM?

Any help would be greatly appreciated

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

DominikTylczyn
Active Contributor

Help sap_beginner01

Check the note 634744 - Displaying MM and FI document number

The note basically says to set up PID IVFIDISPLAY = X in SU3 for the user that posts invoices. This way MIRO will display the FI document number long with logistics invoice number.

I hope it also work with the BAPI.

As the PID doesn't work for the BAPI, you can try getting FI document from a logistics invoice with the MRM_FI_NUMBER_DISPLAY function.

Best regards

Dominik Tylczynski

sap_beginner01
Explorer
0 Kudos

Thank you for the response but I couldn't access this link. HTTPS request failed.

DominikTylczyn
Active Contributor
0 Kudos

sap_beginner01 See my updated answer.

sap_beginner01
Explorer
0 Kudos

I tried this but it did not work unfortunately.

Thank you.

DominikTylczyn
Active Contributor
0 Kudos

sap_beginner01 See my updated answer.

sap_beginner01
Explorer
0 Kudos

This function won't work for me because I do not have the BELNR as it is what I want to get. I only have the material document number produced in MIRO after posting an invoice.

DominikTylczyn
Active Contributor

sap_beginner01 MRM_FI_NUMBER_DISPLAY works. It takes logistic invoice posted in MIRO and returns the corresponding FI document number. IVFIDISPLAY needs to be set to X for the function to work.

sap_beginner01
Explorer

I tested this out and it works!
Thank you so much for your patience and assistance.
Really appreciate it.

sap_beginner01
Explorer
0 Kudos

I am back again.

So MRM_FI_NUMBER_DISPLAY is a regular FM and I want to call it from outside SAP.
Is there any way to do this? Or should I look for another FM that can be called remotely?

Kind regards,

DominikTylczyn
Active Contributor
0 Kudos

sap_beginner01 I think the easiest way would be to create a custom RFC function as a wrapper around MRM_FI_NUMBER_DISPLAY.

Answers (1)

Answers (1)

raymond_giuseppi
Active Contributor
0 Kudos

Did you set the option WAIT in the BAPI_TRANSACTION_COMMIT?

Also type MKPF and BKPF are relevant for material movement and pure financial document, for received vendor invoce try BAPI_ACC_DOCUMENTS_READ

  • AWTYP = RMRP 'Invoice receipt'
  • AWKEY = RBKP-BELNR + RBKP-GJAHR
  • Check also FM MRM_AC_DOCUMENT_SENDER_RMRP
  • Browse table TTYP in case of doubt