In my previous post, I explained the BAPI that can be used to post clearing transactions. Today, I will discuss the BAPI to show accounting entry simulation before the actual posting. In this scenario, you can use the BAPI FAGL_SPL_SIM_GL_VIEW.
SAP provides the functionality of simulating an accounting entry before posting it to the GL accounts. This allows a user to display the accounting entry that the system is going to post. Then, the user can validate the accounting entry and post it in the system.
When you execute transactions like F-02, FB60, etc., there is an option to simulate the accounting entry after entering all the details on the main screen. As soon as you click on the Simulate button, SAP displays the accounting entry. In the background, SAP uses the BAPI FAGL_SPL_SIM_GL_VIEW to simulate and display the accounting entry.
But the question is why do you need it? If you have worked on an implementation project, then you must be aware of the custom developments that the client demands from the consultants. In some of the developments, they usually have a requirement to post accounting entries via BAPI_ACC_DOCUMENT_POST. But, before posting the accounting entry directly, sometimes the client asks to display the accounting entry that is going to post in the system. That is where this BAPI can be used.
Table of Contents
Step 1: Execute the BAPI FAGL_SPL_SIM_GL_VIEW in SE37
You can execute the BAPI in transaction code SE37. Enter the BAPI name and click on the ‘Execute‘ button.
After executing the BAPI, you will notice the import parameters I_T_BKPF and I_T_BSEG. As you already know, BKPF is the header table that stores the accounting document header details such as Document Date, Posting Date, Currency, Header Text, Reference, etc.
Similarly, BSEG is a line item table that stores all the line items of an accounting document. The details like GL account, Amount, Cost Center, Profit Center, etc. are stored in the BSEG table.
Step 2: Fill the I_T_BKPF Header Table
The first thing you need to do is fill in both tables. Starting with the header table BKPF, you need to fill in all the required details like Company Code, Document Type, Document Date, Posting Date, etc.
In the screenshot below, I have given the Company Code 1234, Document Type SA, Document and Posting Dates 30th June 2021, Username TEST, Currency USD, and Transaction Code FB01. All these header values will be shown in the simulation BAPI after I execute it.
Step 3: Fill the I_T_BSEG Line Items Table
After filling the header table, you need to enter the data in the line item table BSEG. To complete any accounting entry, you need at least 1 debit and 1 credit line item. In this example, I’m using the GL account posting in both the line items. For line item 1, I have entered the company code, fiscal year, line item number (BUZEI), Account Type S, Debit/Credit Indicator H, Amount $10.
If you want to simulate customers and vendors, you need to use the account types D & K respectively. For the SHKZG field, the debit amount indicator is S, and the Credit amount indicator is H.
I have also entered the expense GL account 6411400121. As you are aware that for any expense account, we need to use a cost object. So, I have also entered the cost center 12345678.
For Line item 2, I have given similar details except for BUZEI, SHKZG, HKONT, and KOSTL. In line item 1, I used an expense account and debited it with $10. In line item 2, I will use a balance sheet account and keep the cost center field blank.
Since this is our second line item, I have given BUZEI as 002 and the Debit/Credit Indicator as Debit (S).
I have entered the balance sheet GL Account 9999999993.
Step 4: Execute the BAPI to Show Accounting Entry Simulation
After entering all the details, you can see that the import parameters’ tables are filled with data. The BKPF table has 1 entry and the BSEG table has 2 entries (1 entry for each debit/credit line item).
You can click on the ‘Execute‘ button to display the simulation results.
After executing the BAPI, you can display all the details that were entered in the import parameters. There are some fields like Posting Period, Ledger, GL account name, etc. that will be automatically picked based on the data entered.
For example, the system will derive the posting period from the posting date field, and GL Account Name from the GL account code.
I hope you have liked this tutorial on the BAPI to show accounting entry simulation. If you have any questions, please feel free to drop a comment or mail at firstname.lastname@example.org. If you have read the whole tutorial, now you can use FAGL_SPL_SIM_GL_VIEW in your custom developments with ease. Until next time, Take Care!!!