Professional Documents
Culture Documents
What is BAPI ?
API method of a business object(BO).
Implemented as an RFC
Architecture
Business Object
Provides Object Oriented view of R/3
business functionality.
Encapsulates R/3 data and business processes, by hiding the structure and implementation.
SAP BO
Object
Object Type
The object type describes the features common to all instances of that object type. This includes information such as the unique name of the object type.
Key Fields
To access a specific instance of the object type
Ex: SalesDocument number of sales order.
Can Conists of several key fields. All the key fields should be from same table. Must be used as parameters in instance dependent BAPIs.
Attributes
Specific property of an object. They can be from different tables. Ex: SalesDocumentType of salesorder.
DataBase
Methods
An operation that is performed on a business object either to access or process business data.
Adding a method
With remote enabled With out remote enabled
Events
Signals to notify that the status change of an business object.
Interface
Group of related methods associated with an object type.
Documentation
Describes the functionality of methods. Possible return messages.
BOR use
Provides an object oriented view of R/3
System data and processes. R/3 application functions are accessed using methods (BAPIs) of SAP Business Objects. Implementation information is encapsulated; only the interface functionality of the method is visible to the user. Arranges the various interfaces in accordance with the component hierarchy, enabling functions to be searched and retrieved quickly and simply. Manages BAPIs in release updates.
RFC Implementation
Function Module which is a remote enabled one. Parameters
Exceptions
Programming Guidelines
The following steps are to be done for an RFC underling a BAPI. BAPIRETURN structure is must as an export parameter To be processed without returning any screen dialogs to the calling application Should not contain Following statements are not allowed. Call Transaction Submit Report Submit Report and Return
Accessing BAPIs
Object-Oriented Access Function Oriented Access
R/3 Server
BAPI BAPI Business Object: Sales Order BAPI BAPI
BAPI BAPI
Function module (RFC capable) Function module (RFC capable) Function module (RFC capable)
Function Builder
Object-oriented access
RFC access
BAPI ActiveX Control BAPI C++ Class library BAPI Java Class library R/3 Dcom Component Connector
Programming Environments
Delphi connect for SAP Access Builder for SAP R/3 Visual Studio
Object Oriented
Set boOrder = oBAPICtrl.GetSAPObject("SalesOrder") Set oOrderHeader = oBAPICtrl.DimAs(boOrder, _ "CreateFromDat1", "OrderHeaderIn") Set otabItems = oBAPICtrl.DimAs(boOrder, _ "CreateFromDat1", "OrderItemsIn") Set otabPartners = oBAPICtrl.DimAs(boOrder, _ "CreateFromDat1", "OrderPartners") Calling the BAPI boOrder.CreateFromDat1 OrderHeaderIn:=oOrderHeader, OrderPartners:=otabPartners, OrderItemsIn:=otabItems, Return:=oReturn
Function Oriented
Calling RFC theModule.setFunctionName("ZEMP_GETLIST"); Module.callReceive(); setting parameters dept = facMan.getSimpleFactory().createSimple( new SimpleInfo(null, IFieldInfo.RFCTYPE_CHAR,10, 0),"DEPT" ); deptTable.setParameterName("emp_table"); Import/Export theModule.addImportParam(dept); theModule.addTableParam(deptTable);
Naming Conventions
Business Object: BUS0001 where 0001 is an active function group. Function Module: BAPI_<object name>_<methodName> Method Name: max 30 chars. Should start with capital letter. GetDetail Reference fields: Structures. Should start with BAPI
Standard BAPIs
They provide basic functions and can be used for most SAP BO. The Object methods with BAPIs can differentiate between Instance Methods and Class Methods. BAPIs for Reading Data : GetList Method type Class GetDetail Instance GetStatus Instance ExistenceCheck Instance BAPIs for Creating or Changing Data : Create or CreateFromData Class Change Instance Delete and Undelete Instance BAPIs for Replicating BO Instances : Replicate and SaveReplica Class
ServiceBAPIs
They provide basic help functions.
Enhancements
It is carried out ensuring the syntax and downward compatibility. Compatible interface enhancements. New Optional parameters New optional fields to structure Incompatible interface enchancements Changes to the field length Changes to the field type Inserting a field within a structure Deleting parameters and fields Adding new mandatory fields or mandatory parameters
CheckList
Have you identified the SAP Business Object involved? Is the BAPI assigned to the appropriate SAP Business Object? Have you identified the key fields and attributes of this Business Object? Have you defined the function module interface using only EXPORTING, IMPORTING and TABLES parameters?
CheckList
Have you defined the formats in which the values must be transferred in the function module interface? Have you included a Return parameter? Are you using the Dictionary structure BAPIRETURN1 or BAPIRET2 for the Return parameter (as of Release 4.0)? Did you create the function group, if required? Did you create the function module? Did you create the documentation for the BAPI in the Function Builder? Did you use the program to map between internal and external data formats?