SAP Contract Accounts Receivable and Payable, SAP ABAP Development

Posting GL entries/Vendor invoice/Customer invoice using BAPI(BAPI_ACC_DOCUMENT_POST)

This blog will provide you the steps and information about how to post journal entries, vendor invoice with TDS & GST, Customer invoice with GST Using BAPI_ACC_DOCUMENT_POST.

The BAPI “BAPI_ACC_DOCUMENT_POST” is used to post accounting entries.

Steps:

1. Go to SE37 T-code.

2. Enter functional module: BAPI_ACC_DOCUMENT_POST

Note: – This is the important step you need to do while posting any document using BAPI.

3. Before posting any document through BAPI we need to give commitment with functional module.

4. Follow the path shown in above screenshot click on Test sequences.

5. As soon as you click on sequence option as pop up will come as shown in below screenshot.

6. Enter the functional module: – BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT. As shown in below screenshot the click on execute.

7. As soon as you click on execute as new screen will get open.

8. First, we will post GL to GL entries.

9. Click on document header to enter head data.

10. Enter header data such as

  • Header text
  • Company code
  • Document date
  • Posting date
  • Fiscal year
  • Document type as shown in below screenshot, then click on ok and go back.

11. Then click in ACCOUNTGL to enter GL line items.

12. Select the line and click on single entry option as shown in below screenshot.

13. A pop up will come.

14. Fill all the line item details, since this is G/L line item so will fill details like

  • Line item1.
  • G/L Account
  • Company code
  • FIS_period
  • FISC_YEAR
  • Cost center/Profit center.
  • Enter dr cr indicator

15. Here in the below screenshot we can see first line item got updated now we have to enter data for second line item.

16. To fill second line item data, click on insert line option.

17. As soon as you click on insert line item a new line can be seen in screen.

18. Here fill second lite item details.

19. Then click on CURRENCYAMOUNT to fill amount related details.

20. Select the line and click on single entry option.

21. Enter the amount for line item 1

22. Enter the amount for line item 2 also.

23. Now the document is ready to execute.

24. To post the document just click on execute option.

25. As soon as you click on you will get document number as highlighted in above screenshot.

26. The document is not actually posted this is like test run.

27. To post document actually, click on back option.

28. Here in this screen we have click on execute again to post document actually.

29. Now the document is actually got posted.

30. To display document go to FB03 T-code.

31. Enter the document number and press enter to display entry.

If any error is occurred while posting the entry through BAPI.

For e.g. the in the above screen shot it can be seen that the entry is not posted due to error we can see the error in return highlighted in above screenshot.

In the above document the error is balance in transaction the amount is not balance due to which the document was not got posted. This is sample where we can see the errors.

2) Now Will post Vendor invoice.

1. Follow the same steps of till entering BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT IN Test sequence and execute.

2. Then fill header data for vendor invoice as shown in above screenshot.

3. Since in vendor invoice one G/L line item includes so im entering G/L line now.

4. Enter

  • line item as 2(here im intestinally took 2 if you want you can take 1 also)
  • Expense G/L
  • text
  • company code
  • cost center.

5. Then click on back.

6. Click on Account payable to enter vendor line item details.

7. Enter

  • vendor code.
  • company code.
  • withholding tax code(since we are posting entry with TDS).
  • business place.
  • Tax code(for GST).

8. click on Account tax option to specify tax related details.

9. Enter

  • Enter line item number as 3
  • enter GST G/L.
  • Enter condition.
  • Enter account type
  • Enter tax code
  • Tax rate.

10. click on CURRENCYAMOUNT to enter amount details.

11. Enter the amount as per line item numbers as shown in above screenshot.

12. Click on ACCOUNTWT to enter withholding tax details.

13. Here enter withholding tax code and base amount on which the TDS need to get calculated.

14. Document is ready to post.

15. click on execute option.

16. document number can be seen in above document go back.

17. click on execute to post vendor invoice.

18. display the document in FB03.

3) Now will try to post Customer invoice with GST.

1. Follow the same steps of till entering BAPI_ACC_DOCUMENT_POST & BAPI_TRANSACTION_COMMIT IN Test sequence and execute.

2. Fill the header data as shown in above screenshot.

3. click on ACCOUNTGL to enter revenue line item.

4. Enter GL line item details.

  • line item number.
  • GL code
  • Company code
  • period
  • fiscal year
  • profit center

5. Click on ACCOUNT RECEIVABLE to enter customer related data.

6. Enter the customer line item data.

7. Enter tax line items as shown in above screenshot.

8. Now document is ready to post.

9. To post document click on execute option.

10. Here in the above screenshot document number can be seen just go back

11. click on execute to post the customer invoice.

12. The document got posted.

13. Go to FB03 to display document.