$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
SAPintermediateNew

SAP FI GL Posting

Share

Create general ledger postings with BAPI_ACC_DOCUMENT_POST

Works with OpenClaude

You are an SAP FI (Financial Accounting) specialist. The user wants to create general ledger postings programmatically using the BAPI_ACC_DOCUMENT_POST function module.

What to check first

  • Verify SAP system connectivity and user authorization for transaction FBV1 (Document Entry - General)
  • Check that your user has posting permission in the relevant company code and fiscal year
  • Run SE37 and search for BAPI_ACC_DOCUMENT_POST to confirm function module exists in your system

Steps

  1. Populate the DOCUMENTHEADER structure with document type (e.g., 'SA' for GL posting), posting date, document date, and company code
  2. Build the ACCOUNTGL table with line items, specifying account number, debit/credit indicator ('H' for debit, 'S' for credit), and amount in document currency
  3. Set CUSTOMERCUSTOMER or VENDORVENDOR tables if posting involves customer/vendor accounts (optional)
  4. Include CURRENCY structure to define the document currency code (e.g., 'USD', 'EUR')
  5. Call BAPI_ACC_DOCUMENT_POST with all populated structures and capture the return table for errors
  6. If posting succeeds, extract the document number from the DOCUMENTNUMBER return parameter
  7. Call BAPI_TRANSACTION_COMMIT immediately after to persist the document in the database
  8. Parse the return messages table to identify any validation warnings or errors that occurred

Code

REPORT zfi_gl_posting.

DATA: ls_documentheader TYPE bapiache09,
      lt_accountgl      TYPE TABLE OF bapiacgl09,
      ls_accountgl      TYPE bapiacgl09,
      lt_return         TYPE TABLE OF bapiret2,
      ls_return         TYPE bapiret2,
      lv_docnumber      TYPE bapibankaccount-bban,
      lv_fiscalyear     TYPE bapiacgl09-fisc_year.

START-OF-SELECTION.

  CLEAR: ls_documentheader, lt_accountgl, lt_return.

  " Populate document header
  ls_documentheader-doc_type   = 'SA'.          " GL posting doc type
  ls_documentheader-comp_code  = '1000'.         " Company code
  ls_documentheader-doc_date   = sy-datum.
  ls_documentheader-post_date  = sy-datum.
  ls_documentheader-ref        = 'MANUAL GL POST'.
  ls_documentheader-username   = sy-uname.

  " First line item - debit GL account
  CLEAR ls_accountgl.
  ls_accountgl-itemno_acc      = '001'.
  ls_accountgl-gl_account      = '100000'.      " GL account number
  ls_accountgl-costcenter      = 'CC

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategorySAP
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
sapfigeneral-ledger

Install command:

curl -o ~/.claude/skills/sap-fi-gl-posting.md https://clskills.in/skills/sap/sap-fi-gl-posting.md

Related SAP Skills

Other Claude Code skills in the same category — free to download.

Want a SAP skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.