BAPI_PO_GETDETAIL1 — BAPI_PO_GETDETAIL1 for reading purchase order detail
BAPI_PO_GETDETAIL1 reads a single purchase order and returns header, item, account assignment, text, and history data, mirroring what ME23N displays. It is read-only, requires no commit, and its most common failure is not an error at all but an import flag left unset, which silently leaves the corresponding export table empty even though the PO and the RETURN table both look fine.
This page covers what BAPI_PO_GETDETAIL1 actually returns versus what callers assume it returns, why empty output tables are usually a flag problem rather than a data problem, and where interfaces built on this BAPI break in practice. It also covers RETURN table handling, since misreading it is the most frequent source of downstream defects.
Published 16 Sept 2026· 1,001 words
What it does
BAPI_PO_GETDETAIL1 operates on the purchase order business object and functionally mirrors the display view of ME23N. Given a purchase order number, it returns header data (vendor, purchasing organization, document type, terms), item data (material, quantity, price, plant, deletion and blocking indicators), and, depending on which optional sections are requested, account assignment lines, item and header texts, schedule lines, and PO history (goods receipts, invoice receipts, and related follow-on documents). It does not create or change anything. It is the standard way to pull a complete purchase order snapshot into an interface, a monitoring report, or a custom approval workflow without touching the database tables directly.
Important parameters
- PURCHASEORDER - import, the 10-digit purchase order number, mandatory
- ITEMS - import flag, controls whether the item table is populated in the response
- ITEM_TEXTS / HEADER_TEXTS - import flags, control whether text tables are returned
- ACCOUNT_ASSIGNMENT - import flag, controls whether account assignment lines are returned for account-assigned items
- HISTORY - import flag, controls whether PO history (goods receipt and invoice receipt records) is returned
- POHEADER - export structure, the purchase order header data
- POITEM - table, item-level data, populated only if the ITEMS flag was set on the request
- POACCOUNTASSIGNMENT - table, account assignment detail per item
- POHISTORY - table, follow-on document history per item
- RETURN - table of type BAPIRET2, messages describing the outcome of the call
Commit behaviour
This BAPI performs no database change and therefore has no commit requirement. Calling BAPI_TRANSACTION_COMMIT after it is harmless but pointless, since there is nothing pending to persist. Callers occasionally wrap it in the same commit logic used for the create and change BAPIs out of habit, which does no damage but adds unnecessary round trips in high-volume interfaces. The only state that matters here is read consistency: if the call runs inside a long-running session against a PO that another process is changing at the same time, the snapshot returned may not reflect the very latest change, but that is a timing issue, not a commit issue.
Return handling
RETURN should be checked for entries with type E or A before any of the export tables are trusted, but the more damaging habit is checking RETURN alone and assuming a clean RETURN means all requested data came back. It does not. If the ITEMS flag was not set on import, POITEM comes back empty and RETURN is still clean, because nothing went wrong from the BAPI's point of view; the caller simply did not ask for items. Interfaces that then conclude 'the PO has no items' on the strength of an empty POITEM table are reading a configuration mistake as a business fact. The same applies to ACCOUNT_ASSIGNMENT and HISTORY: an empty table can mean no data exists, or it can mean the flag was never passed. Always verify the import flags actually sent before trusting an empty result, and log RETURN in full rather than checking only for the presence of an error type, since informational messages about authorization restrictions on specific fields can appear without stopping the call.
ECC vs S/4HANA
BAPI_PO_GETDETAIL1 remains usable on S/4HANA. The underlying purchasing tables were restructured under the hood, and the BAPI continues to work against them through the compatibility layer, so existing interfaces built on it do not need to be rewritten purely because of a migration. For new development, SAP's direction is toward released OData-based APIs for purchase order data rather than new BAPI consumption, but that is a separate API surface, not a straight one-for-one BAPI replacement, and no newer BAPI has superseded this one for simple read scenarios.
Common pitfalls
- Caller omits the ITEMS, ACCOUNT_ASSIGNMENT, or HISTORY flag and then reports the BAPI as broken because the corresponding table is empty; the fix is in the calling code, not the BAPI
- Deleted or blocked PO items are still returned in POITEM; interfaces that do not check the deletion indicator process line items that no longer count
- PO history for old purchase orders with years of goods and invoice movements can be large, and requesting HISTORY inside a tight loop over many POs causes timeouts in batch interfaces
- Authorization restrictions at plant or purchasing organization level cause the call to return with a restricted or empty result and a message in RETURN, which is frequently misread as the PO not existing
- Calling this BAPI PO by PO inside a loop for mass reporting is far slower than a direct read against the purchasing tables or a call to the item-list variant designed for multiple documents
Whose problem this is
An empty or incomplete result is almost always a calling-program configuration issue, meaning the functional or interface team needs to confirm which import flags were actually passed, not assume the BAPI is faulty. A genuine developer issue looks different: a dump, a short-dump on a specific PO, or a RETURN entry with an unrecognized message class the interface cannot parse. Bring the exact import parameters and the full RETURN table content when escalating either way.
Related SAP objects
Reviewed pages this object connects to in the ERPClimb knowledge graph.
Source: ERPClimb — https://erpclimb.com/sap-bapis/bapi-po-getdetail1ERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.