cancel
Showing results for 
Search instead for 
Did you mean: 

Getting accounting document number after posting using BAPI

10-17-2023 2:59 PM
sap_beginner01 Explorer
3706 views 11 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

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

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

Dominik_Tylczynski
SAP Champion
SAP Champion

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 Likes

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

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Likes

sap_beginner01 See my updated answer.

sap_beginner01
Explorer
0 Likes

I tried this but it did not work unfortunately.

Thank you.

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Likes

sap_beginner01 See my updated answer.

sap_beginner01
Explorer
0 Likes

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.

Dominik_Tylczynski
SAP Champion
SAP Champion

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 Likes

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,

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Likes

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)

RaymondGiuseppi
Active Contributor
0 Likes

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