What is BAPI ?
SAP BAPI (Business Application Programming Interface) is a standard
interface to the business object models in SAP products. BAPIs are the
primary method through which customer code and third-party applications
interact with SAP products.Business API (BAPI) is the most important
component of SAP Business Framework. BAPI enables SAP and third party
applications to interact and integrate with each other at the Business
Object / Process level. BAPIs are implemented using Remotely callable
Function modules. These RFCs are assigned as a callable method of a
Business Object in the Business Object Repository (BOR). All BAPIs are
independent of the screen and hence can work in the background without
user intervention. BAPI supports both inbound and outbound processing.
Since it follows object-oriented approach, SAP has positioned itself to
support interfacing through BAPIs in the future.
The various characteristics of an object are called Attributes. For example, the business object Sales Order is characterized by the following attributes:
What are the Benefits of BAPI
- Can be used in diverse languages / Development Environments(ABAP, Visual Basic, Java, C++, etc.)
- Can be called from diverse platforms (COM, CORBA, Unix)
- Reduced development cost
- Reduced maintenance cost
- “Best-of-both-worlds” approach
- Rich functionality of the R/3 system
- User-specific front-ends
Steps involved in Creation of BAPI’s
- Defining BAPI Data structures in SE11
- Program a RFC enabled BAPI function module for each method
- Create a Business object for the BAPI in the BOR
- Documentation of the BAPI
- Generate ALE interface for asynchronous BAPIs
- Generate and release
BAPI CONVENTIONS
Methods
- If the BAPI to be implemented is a standardized BAPI, use the generic names, for example, GetList, GetDetail.
- The method name must be in English (maximum 30 characters).
- The individual components of a BAPI name are separated by the use of upper and lower case. Example: GetList Underscores ("_") are not allowed in BAPI names.
- Each BAPI has a return parameter that is either an export parameter or an export table.
- So that customers can enhance BAPIs, each BAPI must have an ExtensionIn and an ExtensionOut parameter
Parameters
- If standardized parameters are used, you have to use the names specified for standardized parameters.
- BAPI parameter names should be as meaningful as possible. Poorly chosen names include abbreviations and technical names (e.g. "flag", table names, etc.). The parameter and field names must be in English with a maximum of 30 characters.
- The components of a parameter name in the BOR are separated by upper and lower case letters to make them easier to read. Example: Company Code Detail
- Values that belong to each other semantically should be grouped together in one structured parameter, instead of using several scalar parameters.
- For ISO-relevant fields (country, language, unit of measure, currency), additional fields for ISO codes are provided.
- Unit of measure fields must accompany all quantity fields and currency identifiers must accompany currency amount fields.
Interfacing with BAPI & ALE
BAPIs are integrated into the ALE communication model. ALE communication is asynchronous and message-based. ALE communication is the preferred way to integrate distributed SAP Systems, for example, for distributing master data. Since Release 4.0 BAPIs are the standardized interfaces for ALE-supported communication. ALE services, such as asynchronous BAPI calls, distribution model, monitoring and error handling can be used for BAPIs. The IDoc types required for the ALE services can be generated from BAPIs.BAPI’s are closely tied and work similar to Business Objects in SAP
SAP Business Object is similar to real-world business objects such as Sales Order, Invoice, Employee, etc., which consist of various tables/programs that are related to each other in a business context. All the business objects are maintained in the BOR (Business Object Repository).The various characteristics of an object are called Attributes. For example, the business object Sales Order is characterized by the following attributes:
- Date of the order
- Items of the order
- Prices of various items of the order
- Name of the customer to whom the order belongs to