BAPI is an RFC enabled FM that provides an interface for different processes and corresponding data. These are API for SAP BOs and are stored in BOR – Business Object Repository. It facilitates the connection between two different systems. BAPIs are called within SAP from SAP and non-SAP applications/programs by direct call (internally) or RFC protocol/ALE/IDoc (externally).
Creating a BAPI consists of four basic steps –
Create BAPI parameters – BAPI (usually) needs input and output data. Using TCode SE11, structures and other dictionary objects are created with an objective that they will be consumed by the BAPI.
Create the RFC Function Module – Now, once the import and export parameters are set, the FM needs to be created. FM is technically a black-box for calling program. Using SE37 and the parameters agreed upon, FM is created. The source code of the FM captured the functionality. FM should be of RFC type. Under tab, Attributes there is a radio button Remote-Enabled Module; the button should be selected.
Add RFC FM to BOR – This is a tricky part because without this step external systems cannot connect with the FM –
- Using TCode SW01, create an object
- On creation, some methods will be auto generated along with interfaces
- Add an API Method using navigation Utilities -> API Method -> Add method
- Add the FM to the method in the pop up. Save the method.
Process and Release – The BO needs to be implemented and generated once before releasing.