What Is SAP BAPI (Business Application Programming Interface)?
Also known as: BAPI, SAP BAPI function, BAPI_PO_CREATE1, BAPI explorer
Definition
A BAPI is a stable, remote-callable SAP function module that exposes a business object method, such as creating a purchase order or posting a goods movement, while running the same validation and authorization checks as the SAP screens.
SAP BAPI (Business Application Programming Interface) Explained
BAPIs are defined in the Business Object Repository (transaction SWO1) and browsed in the BAPI Explorer. Technically each one is an RFC-enabled function module, viewed in SE37, with structured import, export and table parameters and a RETURN table that carries success, warning and error messages. Names follow patterns such as BAPI_PO_CREATE1, BAPI_SALESORDER_CREATEFROMDAT2, BAPI_GOODSMVT_CREATE, BAPI_MATERIAL_SAVEDATA and BAPI_PRODORD_CREATE.
BAPIs that change data do not commit by themselves. The caller must check the RETURN table for errors and then call BAPI_TRANSACTION_COMMIT, or BAPI_TRANSACTION_ROLLBACK on failure. Forgetting the commit is the most common integration bug: the call appears to succeed, but nothing is saved. Calls from outside SAP arrive via RFC using SAP Java Connector, .NET Connector, PyRFC or through middleware.
BAPIs are designed as released, stable interfaces, so they survive upgrades better than direct table writes or batch input recordings of screens. Posting through them preserves authorization checks, number ranges, pricing, account determination and user exits. Direct updates to tables such as MARD or VBAP bypass all of that and produce inconsistent data that SAP does not support.
In S/4HANA, many classic BAPIs are still supported, while SAP also publishes released OData and SOAP APIs through the API Business Hub for cloud scenarios. Choose the BAPI for on-premise RFC integration, and the released API for clean-core and cloud extension scenarios.
Why It Matters
- It is the supported way to write into SAP from scanners, portals, MES and automation, because validation and authorization stay intact.
- A missing commit or unread RETURN table causes silent data loss in integrations.
- Choosing BAPIs over direct table writes keeps upgrades and audits safe.
- AI agents that write back to SAP should do so through BAPIs with human approval, not through screens or database access.
In Practice
A shop floor terminal reports 50 finished pieces. The integration calls BAPI_GOODSMVT_CREATE with movement type 101 for production order 1000234, reads RETURN, finds only type S messages, and then calls BAPI_TRANSACTION_COMMIT with WAIT set. If RETURN contained type E, the integration would call rollback and show the message to the operator instead.
Frequently Asked Questions
Why does my BAPI call succeed but no data is saved?
Update BAPIs need an explicit BAPI_TRANSACTION_COMMIT after the call. Also check the RETURN table, because errors are returned as messages rather than raised as exceptions.
Can I call SAP BAPIs from Python?
Yes. PyRFC, which uses the SAP NetWeaver RFC SDK, calls BAPIs over RFC. Middleware and SAP Cloud Connector are alternatives, and the RFC user needs the right authorizations.
What replaces BAPIs in S/4HANA?
Many BAPIs remain supported. SAP also provides released OData, SOAP and event APIs for cloud and clean-core extensions, which are preferred where available.
Related Terms
API (Application Programming Interface)
An API (Application Programming Interface) is a defined contract that lets one software system request data or trigger functions in another, specifying the available operations, the structure of requests and responses, and the rules for authentication and error handling.
Middleware
Middleware is software that sits between applications and handles the communication, transformation, routing, and reliability concerns of moving data between them, so that the applications themselves do not need to know about each other directly.
SAP IDoc (Intermediate Document)
An IDoc (Intermediate Document) is SAP's standard format for exchanging business data such as orders, shipping notices and master data between SAP and other systems, using ALE for system to system links and EDI for partners.
AI Agent
An AI agent is a system that wraps a language model with tools, memory, and a goal so it can plan a sequence of steps, call external systems, observe the results, and iterate until the objective is met or a limit is reached.
MCP (Model Context Protocol)
MCP (Model Context Protocol) is an open standard that defines how AI applications connect to external tools and data sources, so any compliant client can use any compliant server without custom integration code for each pair.
Working with SAP BAPI (Business Application Programming Interface) in a live environment? Our engineers do this every day - and our AI agents automate most of it.