The BAPI interfaces

The WebSphere® Adapter for SAP Software supports outbound processing for simple BAPIs, BAPI units of work, and BAPI result sets. In outbound processing, message flows call BAPIs and other RFC-enabled functions on the SAP server. The adapter supports inbound processing for simple BAPIs only. In inbound processing, the SAP server sends an RFC-enabled function (such as a BAPI function) through the adapter to an endpoint.

For example, you want to build a service that creates a new customer on the SAP server. You run the Adapter Connection wizard to discover the BAPI_CUSTOMER_CREATEFROMDATA function, and the wizard generates the business-object definition for BAPI_CUSTOMER_CREATEFROMDATA, as well as other Service Component Architecture (SCA) service resources. During BAPI outbound processing, the adapter receives the service request and converts the data into a BAPI invocation.

BAPI interface (simple BAPIs)

A simple BAPI performs a single operation, such as retrieving a list of customers. The adapter supports simple BAPI calls by representing each with a single business object schema.

Simple BAPIs can be used for outbound or inbound processing. You can specify synchronous RFC processing or asynchronous transactional RFC (tRFC) processing when you configure a module for a simple BAPI. In addition, for outbound processing, you can specify asynchronous queued RFC (qRFC) processing, in which BAPIs are delivered to a predefined queue on the SAP server.
  • In synchronous RFC processing, the SAP server and the adapter must be available during processing.
    • In outbound processing, the message flow sends a request, then waits for a response from the SAP server.
    • In inbound processing, the SAP server sends a request through the adapter to an endpoint and waits for a response from the adapter.
  • In asynchronous tRFC outbound processing, the adapter associates a transaction ID with the function call to the SAP server. The adapter does not wait for a response from the SAP server. If the delivery is unsuccessful, the message flow can use the SAP transaction ID (TID) to make the request again. The TID is a field in your message.
  • In asynchronous tRFC inbound processing, the adapter does not have to be available when the SAP server runs the function call. The function call is placed on a list of functions to be invoked, and the call is attempted until it is successful.

    To send function calls from a user-defined outbound queue on the SAP server, you also specify asynchronous tRFC inbound processing.

  • In asynchronous qRFC outbound processing, the process is similar to asynchronous tRFC outbound processing. A TID is associated with the function call, and the adapter does not wait for a response from the SAP server. In addition, the BAPIs are delivered to a predefined queue on the SAP server. By sending BAPIs to the predefined queue, you can ensure the order in which they are delivered.

BAPI work unit interface

A BAPI work unit consists of a set of BAPIs that are processed in sequence to complete a task. For example, to update an employee record in the SAP system, the record needs to be locked before being updated. This task is accomplished by calling three BAPIs, in sequence, in the same work unit. The following three BAPIs illustrate the kind of sequence that forms such a unit of work:
  • BAPI_ADDRESSEMP_REQUEST
  • BAPI_ADDRESSEMP_CHANGE
  • BAPI_ADDRESSEMP_APPROVE

The first BAPI locks the employee record, the second updates the record, and the third approves the update. The advantage of using a BAPI unit of work is that the message flow can request the employee record change with a single call, even though the work unit consists of three separate functions. In addition, if SAP requires that the BAPIs be processed in a specific sequence for the business flow to complete correctly, the work unit supports this sequence.

BAPI result set interface

BAPI result sets use the GetList and GetDetail functions to retrieve an array of data from the SAP server. The information that is returned from the GetList function is used as input to the GetDetail function.

For example, if you want to retrieve information on a set of customers, you use BAPI_CUSTOMER_GETLIST, which acts as the query BAPI, and BAPI_CUSTOMER_GETDETAIL, which acts as the result BAPI. The BAPIs perform the following steps:
  1. The BAPI_CUSTOMER_GETLIST call returns a list of keys (for example, CustomerNumber).
  2. Each key is mapped dynamically to the business object for BAPI_CUSTOMER_GETDETAIL.
  3. BAPI_CUSTOMER_GETDETAIL is processed multiple times, so that an array of customer information is returned.

You use the Adapter Connection wizard to discover the BAPI_CUSTOMER_GETLIST and BAPI_CUSTOMER_GETDETAIL functions and build the key relationship between the two BAPIs. The wizard then generates business object definitions for these BAPIs as well as other SCA service resources. At run time, the client sets the values in the BAPI_CUSTOMER_GETLIST business object, and the adapter returns the corresponding set of customer detail records from the SAP server.

Note: It is recommended that you modify the mapping from the Adapter to the SAP node when you migrate from a previous version of the Adapter for SAP to the current version of the Adapter for SAP. This precaution prevents empty tags in the BAPI response structure for uninitialized table parameters.