BAPI_ACC_GL_POSTING_POST — BAPI for Posting General Ledger Documents
BAPI_ACC_GL_POSTING_POST posts a G/L-only accounting document, mirroring the function of FB50 or F-02 without customer or vendor line items. It requires an explicit BAPI_TRANSACTION_COMMIT after the call, and every integration built on it must parse the RETURN table for message type, not just check that the call returned without a dump.
This page covers BAPI_ACC_GL_POSTING_POST, the released interface for posting general-ledger-only accounting documents into FI. It focuses on the parameter structures that carry header and line data, the commit step that callers routinely forget, and the RETURN table parsing mistakes that cause silent posting failures in interface programs.
Published 16 Sept 2026· 997 words
What it does
BAPI_ACC_GL_POSTING_POST posts an accounting document consisting only of general ledger line items, functionally equivalent to what a user would key into FB50 or F-02 when no customer or vendor line is involved. It sits in the same family as BAPI_ACC_DOCUMENT_POST but with a narrower interface: no accounts receivable table, no accounts payable table, no tax line table beyond what is passed in the G/L items themselves. It is the natural choice for integrations that push journal entries from external systems, treasury tools, billing engines or non-SAP subledgers into FI where every line lands on a G/L account rather than a subledger account. The underlying business object is the accounting document; the BAPI creates one document per call and returns its number once the posting succeeds.
Important parameters
The interface is compact compared to its sibling BAPI_ACC_DOCUMENT_POST because it only carries G/L line data.
- DOCUMENTHEADER - document date, posting date, document type, company code, reference and header text; one structure per call, so one document per call
- ACCOUNTGL - the table of general ledger line items, one row per posting line with G/L account, debit/credit indicator, and account assignment fields such as cost center or profit center
- CURRENCYAMOUNT - the table of amounts per line item and currency type, linked to ACCOUNTGL by item number; document currency and local currency amounts are supplied here rather than in ACCOUNTGL
- EXTENSION1 - customer append structure used to pass fields not covered by the standard interface, consumed by BAdIs or user exits on the posting side
- RETURN - the BAPIRET2 table carrying every message the posting logic generated, including the message that contains the new document number on success
Commit behaviour
The BAPI does not commit. It builds the document inside the calling LUW and hands back a document number in the RETURN messages, but the posting only becomes durable when the caller issues BAPI_TRANSACTION_COMMIT. Interfaces that skip this step, or that call it conditionally based on a flag that never gets set, see the call return cleanly with what looks like a valid document number, only for the document to vanish because the update was rolled back at the end of the session. This is the single most common cause of the report that a posting BAPI worked in a test but the document is not in BKPF, and it has nothing to do with the BAPI itself.
Return handling
RETURN is a table, not a single flag, and every row has a TYPE field that can be S, E, W, A or I. The only safe pattern is to scan the whole table for TYPE E or TYPE A before deciding the posting succeeded; checking only whether the call dumped, or checking only the first row, misses the common case where an early informational message is followed by an error further down the table. The document number, when posting succeeds, is not returned in a dedicated output parameter but embedded inside a success message in RETURN, so interfaces that parse it with a fixed offset break the moment the message text or number of leading messages changes. Interfaces that log success purely because no exception was raised, without inspecting message type, routinely report documents as posted that were rejected for a closed posting period or an unbalanced amount. Any wrapper around this BAPI should extract the message class, number and variables explicitly rather than pattern-matching on message text.
ECC vs S/4HANA
BAPI_ACC_GL_POSTING_POST remains a released, supported BAPI on S/4HANA and continues to post into the universal journal through the standard posting logic underneath. It has not been formally deprecated. For new integration builds, particularly cloud-to-cloud or partner scenarios, SAP's published communication scenarios and OData-based journal entry APIs are the preferred entry point, and many S/4HANA implementations steer new interfaces there while leaving existing BAPI-based integrations in place. For established on-premise custom code this BAPI is still a normal, working choice.
Common pitfalls
Most failures trace back to a small set of recurring causes.
- Missing BAPI_TRANSACTION_COMMIT after a clean RETURN, so the document is built and then discarded
- Amounts in CURRENCYAMOUNT that do not sum to zero across debit and credit lines, rejected with a document-not-balanced message that gets logged as a generic failure without the real cause
- Posting period closed for the company code, an error the calling program treats as a technical failure rather than a configuration one
- Missing or wrong account assignment such as cost center or profit center, which validation only catches if the field is actually populated on the ACCOUNTGL line rather than left to derivation that this BAPI does not perform
- Using this BAPI for a posting that actually needs a customer or vendor line, which it cannot carry; BAPI_ACC_DOCUMENT_POST is the correct choice in that case
Whose problem this is
A posting rejected for a closed period, missing account assignment, or account determination problem is a functional configuration issue and belongs with the FI consultant. A posting that reports success but never appears in the ledger, or that fails with a dump, is an interface defect and belongs with the developer, who should be asked to show the commit call and the full RETURN table content, not just the first message.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-acc-gl-posting-postERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.