This post shows how to post a document using BAPI_ACC_DOCUMENT_POST
Overview-This BAPI is used to post financial documents, it can be a vendor invoice, a G/L document or another type of document.
A lot ot interfaces use this BAPI to post a document.
Sometimes you get an error in this interface and you are not sure what the issue is.
To replicate the issue through the interface could be a really long process.
There could be 100’s of documents in the file and the issue can be replicated with one document using the standard BAPI.
Enter BAPI_ACC_DOCUMENT_POST in SE37 and click on test
This shows the list of all structures in which you can enter data.
The goal here is to enter the same information as what is sent by the interface program.
you should first get the data from the program and then enter it in here.
Double click on the import parameters to enter info in there
Enter your document header information.
1-User name
2- Header text
3- Company code
4-Document Date
5- Posting date
6- Trasaction date
7-Fiscal Year
8-Document Type
9-Ref doc number
Once you click on the icon, you can see the list of fields in a better display.
Verify all the info and then go to the next step.
Click on the account G/L and enter the G/L info
Enter your G/L information in here.
If this is a G/L document that you are posting, then you would need two lines, one for debit and another for credit.
If this is a vendor invoice, then you would just enter the debit information and the vendor info would be in another structure.
Enter the following fields
1- item number- 0000001. This has to correspond with the number in a further step.
2- G/L account
3- Item text
4- Cost center
You need to enter all the info that you would if you were going to post this invoice using FB60, for example.
you can click on the overview icon to see a view like below
Move on to the next structure for e.g. accounts payable as we are posting a vendor invoice.
If you were posting a customer invoice, you would pick the accounts receivable structure and if it was just a G/L posting, then both the dr and the cr would be in the above structure.
Click on the icon shown above and then enter the vendor details
We entered the following items
Itemno_ACC– 00000002- Keep a note of this number as we need to enter it in a later step.
Vendor_NO- The vendor number
and any other info that is required
Next- click on currency amounts and enter the amounts there.
Here is where you enter the amount.
you need to enter the debit and the credit amount.
Note- The credit amount should be entered with a – sign.
The important thing in this step is the Item No
The item No has to correspond with what you entered in the previous steps.
In this case we had entered 000001 for the G/L account
and 00002 for the vendor account.
If you entered 000003 for the G/L structure and then entered 00002 over here, it won’t work.
In the above screenshot, we have 000001 with the amount as $1
If you recall, we had entered 000001 in the G/L structure
Once you enter this info, click on execute.
you will see results for each of the tables.
Click on the Return table.
there should be no errors here. If there are errors like shown above, you will have to go and fix the tables based on the error message.
In this case, I am changing the reference document number.
Then hit execute again and check
It tells you that the document has been posted successfully.
This can be confusing as the document has not actually posted.
If you go to FB03, you will not see this document.
In order to post the document there is no more step.
First, save the data you entered
Then go back to the main screen of SE37 and click on function module->test sequence
Enter the function modules in the sequence below.
BAPI_ACC_DOCUMENT_POST
BAPI_TRANSACTION_COMMIT
click on execute and then go to the test data directory and pick the variant you had saved.
This will populate all the tables
Click on execute and go to the return table
Ensure that the document is posted
Then click on back and you will get the screen below.
Here is where the document posted is being committed.
Click on execute
and you should see a value in the return value.
if you go to fb03 and enter that document number, you should see the document.
If you go into the document header, you will see that it was posted by Se37
Did you find this helpful? any questions? leave a comment below.
Can we clear and post open item with this bapi
Hi Raju- it will create an open item if you are using a G/L account that is open item managed. It won’t clear open items through standard, but you could try using POSTING_INTERFACE_CLEARING.
This BAPI should also be able to clear the open items with a BTE. I haven’t done it personally. Let me know if you are able to do so.
I found this on SCN
check this function module SAMPLE_INTERFACE_RWBAPI01.
need to update below four fields of table accit.
REBZG (document no against u want to clear)
REBZJ (fiscal year)
REBZZ (line item)
REBZT
accountwt data withholding tax i want to pass and run BAPI FOR VENDOR down payment i.e posting key 29 .
bapi should run with TDS LINE.
Thanks,
Nitin Navle,
SAP-ABAP.
Thanks a lot, Great Document!!!!!
Great document. Thanks a lot. Really appreciate it.
Thank you!!! i was doing everything except test sequence and wasn’t able to post – with your instructions it worked…finally!!! Thanks again!!!
Great content! Keep up the good work!
Great …..
How to Park document ?!, thanks a lot.
Hello Dear how can i module post key with it. i need Posting Key 50 Offset 25. how i can do?
But in this article post the document but I want to park the document against multiple gl line items?
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.