BAPI To Show Accounting Entry Simulation: FAGL_SPL_SIM_GL_VIEW

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.

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.

Enter BAPI FAGL_SPL_SIM_GL_VIEW in SM37
Enter BAPI Name in SE37

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.

Enter the Import Parameters in BAPI to show accounting entry simulation.
Enter the Import Parameters

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.

Fill the BKPF Table in BAPI FAGL_SPL_SIM_GL_VIEW
Fill the BKPF Table
BKPF Table Details
BKPF Table Details

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.

Fill the BSEG Table in BAPI to show accounting entry simulation
Fill the BSEG Table

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.

BAPI to show accounting entry simulation
BAPI to show accounting entry simulation

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).

Line Item 2 Details
Line Item 2

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.

Execute the BAPI FAGL_SPL_SIM_GL_VIEW
Execute the BAPI

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.

display the BAPI to show accounting entry simulation
Display the Simulation

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 admin@sapficoblog.com. 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!!!

1Shares

One thought on “BAPI To Show Accounting Entry Simulation: FAGL_SPL_SIM_GL_VIEW

  • 3 September 2021 at 11:10 am
    Permalink

    That’s an amazing blog, Abhishek! You have simplified the technicalities of BAPI extremely well!

    Reply
Average
5 Based On 1

Leave a Reply

Your email address will not be published. Required fields are marked *