In short
BAPI stands for Business Application Programming Interface. It is a function module that SAP itself supplies and maintains, and that performs an action on a business object: creating a sales order, changing a purchase order, retrieving the data of a material. Because BAPIs can be called via RFC, other systems can use them.
Why a BAPI and not build something yourself
- The same checks as in SAP itself. A BAPI applies the business rules that also apply when a user fills in the screen.
- Stable. SAP keeps BAPIs the same across new releases as far as possible.
- Documented. You can find them in the BAPI Explorer (transaction BAPI), per business object.
How it works
- You call the BAPI with the data, for example an order with a header and lines.
- The BAPI checks everything and returns a table of messages: success, warning or error.
- For BAPIs that create or change something, you then call BAPI_TRANSACTION_COMMIT. Only then is the change actually saved. If something went wrong, you do a rollback.
What to watch out for
- Do not forget the commit. Without a commit everything seems to go well, but nothing is in SAP.
- Always read the message table. A BAPI does not report errors as failures, but as messages.
- Not every action has a BAPI. If there is none, a custom RFC function module or an OData service is the alternative.
- An integration that creates documents in SAP can have licence implications.
Would you like advice on SAP BAPIs? Request a free advice conversation.
Updated on