BAPI_AP_ACC_GETOPENITEMS — Vendor Open Item Retrieval BAPI
BAPI_AP_ACC_GETOPENITEMS is a read-only remote-enabled function module that returns the open items on a vendor account for a given company code as of a key date, mirroring the data shown by the vendor line item display transaction. It performs no posting and requires no commit. Callers must check the RETURN table even when the item table comes back empty, since an empty result is not automatically an error.
Covers what BAPI_AP_ACC_GETOPENITEMS returns for a vendor account, its main import and export parameters, why it needs no commit, and the RETURN table handling mistakes that cause interfaces to silently treat a valid zero-item answer as a failure. Also covers where it sits relative to newer S/4HANA reporting APIs.
Published 16 Sept 2026· 1,048 words
What it does
BAPI_AP_ACC_GETOPENITEMS reads the open items posted to a vendor account in a given company code, evaluated as of a specified key date. It mirrors the business content of the vendor line item display transaction restricted to open items: invoices, credit memos, and down payments not yet cleared, together with due dates, amounts, and clearing status as of the selection date. It does not create, change, or clear any accounting document. It is used by external systems and custom programs that need vendor liability data without going through a screen transaction, for example a treasury system checking outstanding payables before releasing a payment run, or a reconciliation job comparing what a subledger shows against what a legacy system expects.
Important parameters
- COMPANYCODE - the company code whose vendor ledger is being read; a mandatory import.
- VENDOR - the vendor account number to select open items for; a mandatory import.
- KEYDATE - the date as of which open item status is evaluated; items cleared after this date still appear as open, items cleared on or before it do not.
- OPENITEMS - the export table holding one row per open item, carrying document number, fiscal year, line item, amount in document and local currency, due date, and payment terms data.
- RETURN - the standard BAPI return table carrying messages of type E, W, S, or I; the only reliable indicator of whether the read completed and whether anything went wrong.
Commit behaviour
This BAPI performs no database change, so it does not commit anything and calling it does not require a following BAPI_TRANSACTION_COMMIT. Nothing is written, locked for update, or left in a pending state. Callers who add a commit anyway are not wrong, just wasting a round trip; it has no effect on the result. The point worth remembering in an interface design review is the opposite mistake: treating this as if it were a posting BAPI and building retry or rollback logic around it that has nothing to act on. Any failure here is a selection failure, not a transactional one, and retrying the call with the same parameters simply repeats the same read.
Return handling
RETURN must be scanned for message type before OPENITEMS is trusted. A clean call with genuinely no open items on the account returns an empty OPENITEMS table and an empty or informational RETURN, which is a valid business answer, not a fault. The interface bug that shows up repeatedly is code that treats an empty OPENITEMS table as an error condition and raises an exception or alert, when the vendor simply has nothing outstanding. The opposite bug is equally common: an E-type message in RETURN, for example the vendor not existing in the given company code, gets ignored because the caller only checks whether OPENITEMS is populated, and the interface then reports zero payables for a vendor that actually cannot be read at all. Both faults come from skipping the message-type check on RETURN and inferring success or failure from the shape of the data table instead. Log the full RETURN table on every call during interface build, not just when something looks wrong, because silent warnings about currency conversion or authorization restriction often explain amount discrepancies discovered weeks later.
ECC vs S/4HANA
This BAPI predates S/4HANA and continues to function where the underlying vendor line item tables are populated, since S/4HANA retains compatibility views over the universal journal for classic FI reporting. It is not part of the newer released API portfolio built for S/4HANA integration scenarios, and SAP's current direction for external systems reading financial line items favors OData or CDS-based APIs exposed for accounts payable reporting. New builds should evaluate those released interfaces first; this BAPI remains usable for existing integrations and quick ad hoc reads but is not the interface to design a new payables integration around.
Common pitfalls
- Key date semantics differ from what callers expect from a simple due-date filter; an item cleared the day after the key date still counts as open, which produces different totals than a naive query against the line item table.
- Large vendor accounts with thousands of historical line items cause slow response times because the BAPI reads across open and cleared item tables to determine status as of the key date, not just a single open item table.
- Special GL transactions such as down payments or guarantees are included in the result and inflate the apparent open balance if the consuming program was only expecting standard invoices.
- Vendor extended to the company code but with incomplete reconciliation account setup returns a message in RETURN rather than data, and this is frequently misread as 'no open items' by interfaces that do not check message type.
- Amounts returned in document currency get compared directly against local currency figures on the receiving side without conversion, producing balance mismatches that look like a data quality issue but are a unit mismatch.
Whose problem this is
A wrong or missing balance is a functional problem first: check vendor master extension to the company code, reconciliation account assignment, and whether the key date used matches the business question being asked. Developer involvement is needed only when RETURN shows a dump-level failure, a connection or authorization object error, or when the interface itself is misreading RETURN and reporting false negatives.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-ap-acc-getopenitemsERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.