Bapi (Business Application Programming Interface) : August 12, 2011 1
Bapi (Business Application Programming Interface) : August 12, 2011 1
Agenda
Introduction to BAPI Structure of a BAPI Business Object Implementing a BAPI Error Handling Rules & Guidelines for BAPI Programming
Overview
Uses
Business object technology and business object programming are based on the concept of "business objects". Real world objects, for example an employee or a sales order, are modelled as business objects in business application systems, such as the R/3 System. You can visualize the SAP Business Objects as "black boxes" that encapsulate R/3 data and business processes, thus hiding the details of the structure and implementation of the underlying data. To achieve this encapsulation, the SAP Business Objects are constructed as entities with multiple layers:
As the graphic shows, the interface layer separates a Business Object's data and the applications and technologies that can be used to access it. To the outside, the SAP Business Objects reveal only their interface, which consists of a set of clearly defined methods. Applications can only access the Business Object data by the object's methods. An application program that accesses an SAP Business Object and its data only needs the information required to execute the methods.
Therefore, an application programmer can work with the SAP Business Objects and invoke their methods without having to know or consider the object's underlying implementation details. The set of methods that is associated with a Business Object represents the object's behaviour. When a method is executed on a Business Object, the method can change the object's internal state, that is, the object's data. For example, one method that you can use on the Business Object "Employee" is to "check for the employee's existence".
All SAP Business Object types and their methods are identified and described in the R/3 Business Object Repository (BOR). The BOR was first implemented with R/3 Release 3.0, the same time when the SAP Business Objects and the SAP Business Workflow were introduced. When it was first released, the BOR was used primarily by the SAP Business Workflow.
10
Business object types The SAP Business Object types are arranged within the BOR in a hierarchical structure based on the R/3 business application areas, such as sales, material management, etc.
Technical object types These are items such as texts, work items, archived documents, as well as development and modelling objects
11
BAPI Explorer
12
13
14
15
16
Standard BAPIs
17
18
19
BAPI Interface
A BAPI interface is defined by: Import parameters, which contain data to be transferred from the calling program to the BAPI Export parameters, which contain data to be transferred from the BAPI back to the calling program Import/export (table) parameters for both importing and exporting data
20
Exception Handling
21
Scenario Scenarioin inwhich which the theBAPI BAPIwill willbe be used used
Review Review BAPI BAPI concept concept and and scenario scenario
Process Flow
Releasing and freezing the BAPI Creating Creating Individual Individual Programming Programming Objects Objects Testing the BAPI
22
OBJECTIVE: To release the function module the BAPI is based on and the method in the BOR To freeze the BAPI as a method in the BOR ESSENTIALS: A BAPI is available as a Business Object method only after it is released and frozen Once a BAPI is released and frozen, all changes made to it are automatically checked for compatibility in the BOR and the ABAP dictionary. Incompatible changes are rejected
August 12, 2011 23
People responsible for the development objects and quality control should be closely involved with this process TASKS Select Function module, Release, Release to release the function module in the function builder In the Business Object Builder, set the status of the method to released. Select the appropriate SAP Business Object and expand the node for Methods
24
Place the cursor on the BAPI and select Edit, Change Status, Released Place the cursor again on the BAPI and select Utilities, API methods, Freeze method to freeze the method Check the new status of the function module in the Function Builder and the method in the BOR
25
Currency amounts with decimal points must have a decimal point in the interface Document the Business object Document all interface parameters Documentation on return parameters must include descriptions of all possible return values and messages Documentation on mandatory parameters must specify fields to be filled
26
BAPIs must not produce any screen output Database changes can only be made through updates To transfer values, do not use the Set and Get parameters and the global memory It is recommended that every BAPI must be able to carry out its own authorization checks Minimize interface complexity A BAPI should always select a range between A-Z, a-z and 0-9
27
The BAPI must not use the following commands: COMMIT WORK CALL TRANSACTION SUBMIT REPORT SUBMIT REPORT and RETURN
Data for customizing or language dependent values cannot be use in interface parameters
28
All field and parameter names must be in English All quantity and amount fields must have quantity unit fields All currency amount fields must have currency indicator fields Key fields in GetDetail and Get List BAPIs must be displayed in a text field It is recommended that F4 input help be provided for fields in BAPI parameters
29
30
Exercises
31
Thank You
32