Business Application Programming Interface or BAPI is a must know lots about subject. Developing in SAP will inevitably involve using standard SAP documents like the Purchase Order. A BAPI will help you do your changes to this standard SAP document... using the "programming interface" that SAP have prepared for this.

So what is a BAPI ? It's a function module that allows the execution of changes (or create) of standard SAP documents. Where an error is found in the data you want to execute a change with, the BAPI will inform you via it's (function module) interface. Hence "Programming interface".

BAPI's are the (historic) answer to the prehistoric BDC sessions or Batch Input Maps. The Batch Input Map setup worked lika a macro over screen "moves" (steps) which can still be used, but there is something much better around now. The idea is that whenever a field on a standard SAP document needs to be set (or a whole PO needs to be created) the table could be updated directly. Of course before a developer can do that, he or she would have to check everything SAP checks, lock everything SAP locks and pray that the "direct update" change does not mess up anything. The project's I've done over the last 10 years did not allow such processing - direct table update on standard SAP tables is forbidden. And unecessary.

What you should do and not do when implementing BAPI's.

  • Do Use BAPI's where possible, most projects will not allow direct table updates on SAP tables, which is (almost always) a realistic approach because of BAPI's
  • Don't Be afraid of the BAPI, it's not always easy, but it's a very solid approach
  • Do Be aware of versions - after a release change you may find a newer version of your BAPI
  • Don't Forget your error processing, and also don't forget you need to COMMIT your WORK.

Where to find BAPI's and getting them implemented. BAPI commonalities: a good place to start understanding BAPI's Here's a topic list on BAPI's:

Transaction BAPI, the BAPI Explorer, holds the overview of available BAPI's. There are loads and loads of them, feel free to snif through.

Naming conventions on the function modules that represent BAPI's start with: BAPI_* (to nobodies surprise), so transaction SE37can also be used to find your BAPI's.

BAPI - Programming interface the parameters that are passed on to and back from BAPI modules will almost always contain:

There are many many BAPI's and some of them get to be used more often then others. Here's a list of quite commonly used BAPI's which can also be used to get an idea of what BAPI's are for... The following BAPIs are quite commonly used. However, there are thousands of BAPI's around so do not regard this list as finite in any way...

A simple example of a call to BAPI_PO_CHANGE. A simple change to a standard SAP field as workable setup. In only a few steps backed by a source code example your BAPI call is explained.

4 steps to setting up your BAPI call

SAP allows customer additions to their own tables, for many of the main documents. E.g. the purchase order can hold data on tables EKKO and EKPO, which can also be maintained via a BAPI call to BAPI_PO_CHANGE. The concept of a BAPI is allowing changes to a document via a programming interface (e.g. a function module). But how should SAP know which fields are added on the customer's site ? How should these fields be made changeable via function module parameters ? SAP's answer: the extension.

Extensions is a concept for allowing changes to non SAP-standard fields, used by several BAPI's. The example outlined here is for BAPI_PO_CHANGEbut also applies to many other BAPIs. The main components of extensions:

Since a BAPI can be used to e.g. create a Sales order via a programming interface (no SAP user to supply any data), calling this function in another system is the key to speedy processing. Most BAPI's are therefore "Remote-enabled functions". Applications like the XI (used to be the Business Connector) or other SAP systems can use the RFC mechanism to retrieve data (e.g. RFC_READ_TABLE or a suite of GETDETAIL functionality on SAP documents) or even change or create documents in the SAP system from an outside call. These calls can be prepared in Java, C, or ABAP, or effectively any language.

Should not be mixed up - they are completely different subjects !

BAPI: Business Application Programming Interface - a function module which allows actions in the system to be performed via a programmed interface. Create / update / release / or simple get detail information about the "subject" can be done via regular screen transactions, as well as via a BAPI.

BADI: Business ADd-In - an ABAP Objects term which effectively acts lika a user exit from a predefined position in a class. SAP can be configured to call such BADI logic when e.g. a document is saved or checked.