SAP BAPI Tutorial – Step by Step Guide to Create BAPI in ABAP

What is BAPI?

Business Application Programming Interface(BAPI) are standardized programming interfaces (methods) enabling external applications to access business processes and data in the R/3 System.

They provide stable and standardized methods to achieve seamless integration between the R/3 System and external applications, legacy systems and add-ons.

BAPIs are defined in the BOR(Business object repository) as methods of SAP business object types that carry out specific business functions.They are implemented as RFC-enabled function modules and are created in the Function Builder of the ABAP Workbench.

Some BAPIs and methods provide basic functions and can be used for most SAP Business Objects.These are called STANDARDIZED BAPI’s.

List of Standardized BAPIs:

  • BAPIs for Reading Data – GetList() , GetDetail() , GetStatus() , ExistenceCheck()
  • BAPIs for Creating or Changing Data- Create() ,Change(),Delete() and Undelete() ,
  • BAPIs for Mass Processing -ChangeMultiple(), CreateMultiple(), DeleteMultiple().

How to create a BAPI

Step 1) Go to transaction swo1 (Tools->Business Framework -> BAPI Development ->Business Object builder ) .Select the business object, according to the functional requirement for which the BAPI is being created.

Create a BAPI in ABAP

Step 2) Open the business object in change mode. Then Select Utilities ->API Methods ->Add method.Then enter the name of the function module and select Continue.

Create a BAPI in ABAP

Step 3) In the next dialog box, following information needs to be specified :

  • Method : Suggest an appropriate name for the method,
  • Texts : Enter description for the BAPI,
  • Radio buttons : Dialog, Synchronous, Instance-independent . BAPI ‘s are usually implemented synchronously.

Create a BAPI in ABAP

Step 4) To create the method select Yes in the next dialog box.

Create a BAPI in ABAP

Step 5) After the program has been generated and executed, check the program in the method just created.Thus , a BAPI is created.

Create a BAPI in ABAP

Testing the BAPI

You can test the BAPI by Testing the individual method of the Business Object in the Business Object Builder. ( or one can use the transaction ‘SWUD’ to test the method ) .

Releasing and freezing the BAPI

  • To release the BAPI , first release the function module ( using transaction se37 ) .
  • Set the status of the method to ‘released’ in the Business Object Builder ( using transaction SWo1 – Edit-> change status-> released. )

You can also use the BAPI Explorer (Transaction code BAPI) for 360′ view on BAPI