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.
Try it here, free
SAP BAPI_GOODSMVT_CREATE ABAP Code Generator
Fill in plant, material, quantity and movement type to get a working ABAP skeleton for posting a goods movement through the standard BAPI.
Keep exploring
Free tools
- SAP BAPI_GOODSMVT_CREATE ABAP Code GeneratorFill in plant, material, quantity and movement type to get a working ABAP skeleton for posting a goods movement through the standard BAPI.
- BAPI_PO_CREATE1 Call Skeleton GeneratorEnter vendor, plant, material and quantity and get a complete BAPI_PO_CREATE1 call with the matching X structures, error handling and BAPI_TRANSACTION_COMMIT.
- SAP BAPI_PO_CREATE1 ABAP Skeleton GeneratorFill in vendor, plant and material to generate an ABAP skeleton for creating a purchase order with BAPI_PO_CREATE1.
ERP fixes and how-tos
- SAP MM BAPI for PO Create and Change: BAPI_PO_CREATE1 and BAPI_PO_CHANGEHow to use BAPI_PO_CREATE1 and BAPI_PO_CHANGE: header, item and schedule structures, the X-structures, error handling in RETURN and the commit step.
- How to Use BAPI_TRANSACTION_COMMIT CorrectlyBAPIs never commit their own update. Here is when to call BAPI_TRANSACTION_COMMIT with WAIT, and why a BAPI can run fine and still save nothing.
- How to add AI to SAP ECC 6.0 on-prem without moving data to a cloudReference architecture for a private on-prem AI assistant on SAP ECC 6.0: RFC and BAPI reads, SLT replica, retrieval index, local LLM, permission mirroring.
Integrations
- How to build an MCP server for SAP ECC 6.0How to build a Model Context Protocol server for SAP ECC 6.0: which BAPI-backed tools to expose, RFC auth, stdio vs HTTP, permission scoping and audit logging.
- How to add AI agents to SAP ECC 6.0How to add AI agents to SAP ECC 6.0: a tool layer over BAPIs, RFC and IDocs, human approval before any posting, and an on-prem model that never leaves your network.