BAPI
A BAPI (Business Application Programming Interface) is a standardised, stable method for accessing SAP business objects programmatically. BAPIs are the recommended, well-documented way to create or read SAP data from code and from other systems.
BAPIs underpin many interfaces and custom programs, and relate to RFC (the transport) and IDocs (document-based exchange).
- A BAPI is a specially-defined, remote-enabled function module that exposes an operation on a business object, for example…
- Most BAPIs do not commit automatically, you call the BAPI, check the returned messages, then call BAPI_TRANSACTION_COMMIT to…
- They enforce SAP’s business logic and validations (unlike raw table writes).
- Watch out: Writing to tables directly instead of using a BAPI, bypassing validations.
What a BAPI is
A BAPI is a specially-defined, remote-enabled function module that exposes an operation on a business object, for example BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order, or BAPI_MATERIAL_GET_DETAIL to read material data. Because BAPIs are part of a stable, released interface, they are safe to call from external systems and custom code.
Why use BAPIs
- They enforce SAP’s business logic and validations (unlike raw table writes).
- They are stable across releases and officially supported.
- They are remote-enabled (callable via RFC) for integration.
- They are documented business objects, easy to find and reuse.
BAPIs and the commit
Most BAPIs do not commit automatically, you call the BAPI, check the returned messages, then call BAPI_TRANSACTION_COMMIT to persist. Forgetting the commit (or not checking the return) is a classic beginner error.
Where BAPIs fit
BAPIs underpin many interfaces and custom programs, and relate to RFC (the transport) and IDocs (document-based exchange). They are the go-to for programmatic, validated access to SAP data.
Common pitfalls
- Writing to tables directly instead of using a BAPI, bypassing validations.
- Forgetting BAPI_TRANSACTION_COMMIT.
- Not checking the BAPI return messages for errors.