Standardized BAPIs

Use

There are a number of BAPIs that provide equivalent services across the whole range of SAP Business Objects. The exact functionality of the individual BAPI is determined by the SAP Business Object for which it is implemented.

The following standard BAPIs are implemented for most Business Objects:

You can use this BAPI to search for object instances that fulfill certain selection criteria. This BAPI returns a list of key fields to the calling program. An example of this BAPI is CompanyCode.GetList, which returns a collection of company codes.

The following code fragment is from a Visual Basic program and illustrates the use of this BAPI:

First, a local object instance with an empty key field is created using the BAPI Control object:

Set oCompanyCode = oBapiControl.GetSAPObject("CompanyCode")

Then, the BAPI CompanyCode.GetList with the parameters Return and CompanyCodeList is invoked and a table is provided for the company codes listing:

oCompanyCode.GetList Return:=oReturn,
CompanyCodeList:=otabCompanyCodes

This BAPI enables you to obtain more information about a specific object instance. The object instance is identified in the object key fields. An example of this BAPI is CompanyCode.GetDetail, which returns additional data about a particular company code to the calling program.

The following example is an extract from a Visual Basic program and shows the use of this BAPI:

First, a local instance of the Business Object CompanyCode with the code number 784 is created using the BAPI Control object:

Set oCompanyCode = oBapiControl.GetSAPObject("CompanyCode", "784")

Then, the BAPI CompanyCode.GetDetail with the parameters Return and CompanyCodeDetail is invoked:

oCompanyCode.GetDetail Return:=oReturn,
CompanyCodeDetail:=oDetail

This BAPI creates an object instance and returns information concerning the object instance to the calling program. An example of this BAPI is SalesOrder.CreateFromData, which creates a sales order based on the data provided by the calling program.

The following example is an extract from a Visual Basic program and shows the use of this BAPI:

First a local object instance with an empty key field is created using the BAPI Control object:

Set oOrder = oBapiControl.GetSAPObject("SalesOrder")

After the required structure/table parameters are obtained and filled, the BAPI is called:

oOrder.CreateFromData OrderHeaderIn:=oHeader,
OrderPartners:=oPartners,
OrderItemsIn:=oItemsIn,
Return:=oReturn

This BAPI changes an existing instance of an SAP Business Object. An example of this BAPI is EmployeePersonalData.Change which changes the data of an employee's record based on the data provided by the calling program.

The BAPI Delete deletes an instance of an SAP Business Object. An example of this BAPI is EmployeePrivAddress.Delete, which deletes the home address in the record of the employee specified by the calling program.