Data & Services

BAPI

A BAPI (Business Application Programming Interface) is a standardized SAP interface, defined as a method of a business object type in the Business Object Repository and implemented as an RFC-enabled ABAP function module. BAPIs give programs and external systems access to SAP business processes and data, and remain common in SAP ERP and SAP S/4HANA integrations.

Quick facts

Type
Classic ABAP interface (RFC-enabled function module)
Layer
Business logic & data model, consumed as a service
Defined in
Business Object Repository (BOR), as business object methods
Explore with
BAPI Explorer (transaction BAPI)
Status under ABAP Cloud
Classic API: not callable directly from ABAP Cloud code
Who works with it
ABAP developers, integration developers, migration teams
Applies to
SAP ERP (ECC), SAP S/4HANA on-premise and Private Edition
Layer: Business logic & data modelWhere it sits ▾
Where it sits: L5 · Business logic & data modelLayer: Business logic & data model. Also touches: Services & APIs.L1L2L3L4L5L6BTP

Layer: Business logic & data model

Also touches: Services & APIs

Open the architecture map →

How does a BAPI work?

A BAPI connects an object-oriented definition to a classic implementation:

  1. In the Business Object Repository, a business object type such as a purchase order declares methods like create, change or get detail. Each of these API methods is a BAPI.
  2. Behind each method sits an RFC-enabled function module, so the BAPI can be called inside the system or remotely over RFC.
  3. The caller passes import parameters and tables; the BAPI reports success or errors in a return parameter typed with the BAPIRET2 structure rather than raising exceptions.
  4. Changing BAPIs follow a transaction model in which the BAPI itself does not commit. The caller decides when to save, typically by calling BAPI_TRANSACTION_COMMIT after one or more BAPI calls, or the rollback counterpart after an error.

The BAPI Explorer, started with transaction BAPI, browses business object types and their BAPIs by application component and shows parameters and documentation. A BAPI is therefore a business-level contract over a function module, with the commit left to the caller.

Where are BAPIs still used?

BAPIs predate SAP Fiori and OData, yet they remain part of many landscapes:

  • Point-to-point and middleware integrations that call SAP ERP or SAP S/4HANA over RFC, for example to create sales orders from a web shop.
  • Data migration and mass processing programs that post documents through the same checks as the dialog transactions.
  • OData services built on top of BAPIs. On-premise, SAP Gateway projects often map an entity's operations to existing BAPIs through the Service Builder's RFC/BOR import, and SAP documents a RAP pattern that calls a BAPI inside a RAP business object through a wrapper class.

At Alder Manufacturing, a supplier portal that creates purchase orders for Cedar Office Supply may still post through a purchase order BAPI wrapped in a newer API. BAPIs often survive as the engine under a modern interface rather than as the interface itself.

What is the status of BAPIs under clean core and ABAP Cloud?

SAP classifies BAPIs as classic APIs. They are not released APIs in the ABAP Cloud sense, so code written in the ABAP for Cloud Development language version cannot call them directly.

DeploymentWhat that means
SAP S/4HANA Cloud Public EditionCustomer code uses ABAP Cloud only, so custom ABAP cannot call BAPIs; for integration with other systems, SAP documents BAPIs that can be called remotely
Private Edition and on-premiseClassic ABAP may still call BAPIs; for ABAP Cloud code, SAP recommends a custom wrapper written in classic ABAP and released with contract C1
SAP ERP (ECC)BAPIs remain a standard integration interface

SAP publishes a list of classic APIs for Private Edition and points developers to the BAPI Explorer to study them. Clean core reporting counts references to listed classic APIs separately from released APIs. A BAPI is therefore tolerated as a bridge in a clean core landscape, not treated as the target interface.

What are common mistakes with BAPIs?

  1. Forgetting the commit. The call returns without errors but nothing is saved, because the caller never triggered BAPI_TRANSACTION_COMMIT.
  2. Ignoring the return table. BAPIs report errors as messages in the return parameter; a program that only checks for exceptions posts nothing and reports success.
  3. Confusing "released" labels. The BAPI Explorer shows BAPIs released in the Business Object Repository, which is not the same as an API released under an ABAP Cloud release contract.
  4. Wrapping without ownership. A C1 wrapper around a BAPI needs an owner who replaces it when SAP releases a successor API.

Most BAPI defects come from the transaction model and message handling, not from the business logic inside the BAPI.

BAPI vs. OData: what is the difference?

BAPIOData
What it isA classic ABAP interface on a business object methodAn open REST-based protocol over HTTP
TransportRFC (or a local ABAP call)HTTP with JSON or XML
Typical consumerABAP programs, RFC-based middleware, migration toolsSAP Fiori apps, SAP BTP apps, web clients
Clean core statusClassic API; usable from ABAP Cloud only through a released wrapperUpgrade-stable only when the service is a released API

A BAPI is a classic RFC interface to business logic, while OData is a web protocol; many OData services in SAP S/4HANA still delegate to BAPIs underneath.

FAQ

Are BAPIs deprecated in SAP S/4HANA?

Not as a whole. BAPIs still exist and work in SAP S/4HANA on-premise and Private Edition, and SAP lists many as classic APIs for wrapper-based use. They are not released for ABAP Cloud, and SAP recommends released APIs for new development wherever they exist.

Why does a BAPI call succeed but no document is saved?

Changing BAPIs do not commit their own work. The caller must trigger BAPI_TRANSACTION_COMMIT after a successful call, and should first read the return parameter, because errors are reported there as messages rather than as exceptions.

Can I call a BAPI from ABAP Cloud code?

Not directly. In Private Edition and on-premise, SAP's recommended pattern is a wrapper class written in classic ABAP that calls the BAPI and is released with contract C1, so that ABAP Cloud code can use the wrapper instead of the BAPI.

How do I find the right BAPI for a business object?

Start the BAPI Explorer with transaction BAPI, navigate the application component hierarchy to the business object type and read the method documentation, which describes parameters and authorization objects. For new integrations, check first whether a released API covers the same operation.

Sources

Applies to
SAP ERP (ECC) · SAP S/4HANA on-premise · SAP S/4HANA Cloud Private Edition
Last reviewed

SAP, SAP Fiori, SAPUI5, SAP S/4HANA, SAP BTP and other SAP products and services mentioned are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. This guide is independent and is not affiliated with, sponsored or endorsed by SAP SE.