BAPI Wrapper Types   |  Testing BAPI Wrappers  |  What is a SyncBO?

 

What is a BAPI Wrapper ?

In this section, we will discuss what BAPI Wrapper is and why it is needed.

A BAPI wrapper is a function module more or less like a BAPI and follows certain rules to be a BAPI wrapper. Conceptually, a BAPI wrapper has the role of a private method of a business object (SyncBO) and resides in a backend system. That is, a SyncBO in Smart Synchronization calls the BAPI wrapper based on the request from a mobile device. Therefore, it is important that each BAPI wrapper has the parameters expected by Smart Synchronization and behaves as expected by Smart Synchronization. For each business object, up to 5 BAPI wrappers can be created and used:

BAPI Wrapper

Description
GetList Returns a list of business object header data based on the selection criteria specified in the Import parameters.
GetDetail Returns one header data as Export parameter out of the header data list based on the object key(s) specified in the Import parameters. It also returns one or more list of item entries associated with the header data.
Create Creates a single business object, and returns object key(s).
Change Modifies the header and/or items of the specified business object. The function needs to replace the entire item data with the entries of Tables parameters (For more information, refer to Change function)
Delete Deletes the specified business object (including the items).

 

The following diagram describes the relationship between the BAPI wrapper parameters and the business objects:



BAPI wrapper is called as such, because it typically wraps an existing standard BAPI. When a standard BAPI is available for the business object of interest, it is strongly recommended to use the BAPI in the BAPI wrapper. This is because SAP guarantees that the interface of BAPIs are stable and they are supported in every version of SAP systems, which results in less maintenance of the BAPI wrapper that uses BAPIs. That is, using BAPIs minimizes the risk to encounter unexpected behavior of a BAPI wrapper due to the changes made in the backend system.

Although it is strongly recommended to use standard BAPIs, if no appropriate BAPI exists, it must be created, or the data access/update logic must be implemented within the BAPI wrapper. Also, there may be cases where a BAPI wrapper needs to call multiple BAPIs, for example, to merge multiple business objects on the backend into one, so that a client application deals with the merged business object, instead of multiple business objects.

 

The following is some of the main reasons why BAPI wrappers are needed:


It is important to understand how BAPI wrappers for a business object can be grouped as a SyncBO and what the client view of the SyncBO will be. In most cases, for example, the business object header of a SyncBO will be the structure defined in that of the GetList BAPI wrapper’s Tables parameter. Then, the business object header for the client will be the subset of the business object header defined in the SyncBO.

For detailed information of SyncBO, please read section Defining Synchronizer Business Object.