BAPI_ACC_DOCUMENT_REV_POST — Reversing accounting documents via BAPI
BAPI_ACC_DOCUMENT_REV_POST reverses an already-posted FI accounting document, mirroring transaction FB08. It takes the original document reference (type, key, logical system), a reversal reason, and a posting date, then creates a new offsetting document. It does not commit on its own and must be followed by BAPI_TRANSACTION_COMMIT, and its RETURN table must be checked for messages before assuming the reversal succeeded.
This page covers BAPI_ACC_DOCUMENT_REV_POST, the BAPI used to reverse a previously posted accounting document without going into FB08 manually. It focuses on the parameters that identify the original document, why silent failures happen when RETURN is not parsed properly, and the configuration and status conditions that block a reversal even when the call itself is technically correct.
Published 16 Sept 2026· 1,107 words
What it does
BAPI_ACC_DOCUMENT_REV_POST reverses an accounting document that already exists in the system, whether it was posted manually, through FB01, or through another BAPI such as BAPI_ACC_DOCUMENT_POST. It mirrors the functional behaviour of FB08, individual document reversal, rather than mass reversal transactions. The BAPI creates a new document with reversed debit and credit entries, links it to the original via the reversal reason and reference, and updates the original document's status to reversed. It operates purely on FI accounting documents (table BKPF and BSEG) and does not touch the originating logistics or sales document, so if the reversal needs to also undo a goods movement or a billing document, that has to be handled separately, typically before or after this call rather than through it.
Important parameters
The interface is narrow compared to the posting BAPIs, since it only needs enough information to identify one existing document and describe how to reverse it.
- OBJ_TYPE - business object type identifying the accounting document, comparable to the value used when the document was originally posted via BAPI_ACC_DOCUMENT_POST
- OBJ_KEY - the combined key (document number, company code, fiscal year) identifying which document to reverse
- OBJ_SYS - logical system of the originating document, relevant in distributed or ALE landscapes
- REASON_REVERSAL - reversal reason code that must exist in the reversal reason configuration and controls whether the reversal is a true negative posting or a mirrored one
- POSTING_DATE - the date the reversal document is posted, which must fall in an open posting period
- RETURN - table of BAPIRET2 structures returned by the call, carrying success, warning, and error messages
Commit behaviour
Like the other document-handling BAPIs in this family, BAPI_ACC_DOCUMENT_REV_POST does not commit the database update by itself. A successful call only means the reversal has been built and validated in the update task; it is not saved until BAPI_TRANSACTION_COMMIT is called afterward. If the caller forgets the commit, the reversal document is not written to the database, the original document still shows as open or cleared exactly as before, and no error is raised anywhere in the interface to indicate this. The symptom in production is a batch job or interface that logs a successful reversal, complete with a document number range, but the document never appears in FB03 or the line item reports, because the number was reserved in the buffer and rolled back with the missing commit.
Return handling
RETURN behaves the same way as in the posting BAPIs and gets misread the same way. The call can return without a dump and without any entry of type E in RETURN while the reversal still did not happen, typically because the document was already reversed, already cleared against a payment, or the reversal reason used forbids reversing documents with cleared items. Interfaces that only check whether the returned document number field is populated, without scanning every RETURN line for type E or A, will report success on a reversal that was actually rejected. The correct pattern is to loop through all RETURN entries, treat any E or A as a full failure regardless of what else is populated, and only trust a returned reversal document number when RETURN contains no error-level entries. Warnings, type W, commonly appear for things like a reversal posting date falling outside the original document's period, and these need visibility in logs even though they do not block the reversal, because they explain why the reversal landed in a later period than expected.
ECC vs S/4HANA
BAPI_ACC_DOCUMENT_REV_POST remains usable on S/4HANA for reversing FI documents and is not marked obsolete. The underlying accounting document model changed with the introduction of the universal journal, but the reversal logic and status handling for BKPF-level documents did not require a new interface for standard reversal scenarios. For newer integration scenarios, particularly cloud-based and event-driven architectures, released APIs built on the same accounting document object are preferred where available, but for on-premise custom developments and existing interfaces this BAPI continues to be the standard call for programmatic reversal.
Common pitfalls
Most incidents trace back to document status or configuration rather than the BAPI call itself.
- Document already cleared - a document with cleared line items generally cannot be reversed until it is reset first, which this BAPI does not do on its own
- Document already reversed - a second reversal attempt returns an error rather than a no-op, and retry logic that does not check for this produces repeated failed calls
- Reversal reason not configured to allow the required behaviour - some reversal reasons are restricted to negative postings only, and using one against a document type that does not support negative postings fails silently in terms of business result even if RETURN looks clean
- Posting period closed for the reversal date - the call fails with a period error that is easy to miss if only the header of RETURN is logged
- Cross-company code documents - reversing one leg of an intercompany document without reversing the linked company code leg leaves the ledger unbalanced across company codes
- Reversing a document that originated from a logistics process - the accounting reversal succeeds but the originating material document, billing document, or invoice is left in an inconsistent state because this BAPI has no awareness of it
Whose problem this is
A rejected reversal or an unbalanced reversal is a functional configuration issue first, usually a reversal reason restriction, an open item clearing status, or a closed posting period. Bring the exact document number, company code, fiscal year, and the full RETURN table content. It becomes a development issue only when RETURN shows no errors but the commit is missing or the calling program suppresses error-level messages before logging.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-acc-document-rev-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.