BAPI inbound scenarios

In SAP, you can call functions in other applications or SAP systems that are registered with SAP as remote function call (RFC) servers. In IBM® App Connect Enterprise, you can register the SAP adapter with SAP as an RFC server so that it accepts synchronous and asynchronous calls from SAP.

Integrating SAP with a system with a synchronous interface

In SAP, a BAPI interface is a function call. If a system is connected to SAP as an RFC server, you can use the BAPI interface to define the interface where a program running in SAP can call an external system. The external system is identified in SAP by its RFCDestination value, which is bound to a program ID in SAP administration. The program ID is specified by the external system when it first connects to SAP.

By using the WebSphere® Adapter for SAP, a message flow can connect to SAP as an RFC Server by configuring the adapter with the relevant program ID and deploying the message flow to the integration node. After deployment, the message flow can receive synchronous function calls by using the BAPI interface.

The reply identifier

The BAPI import parameters are received by the adapter and propagated from an SAPInput node as a message tree structure. The BAPI export parameters are propagated to an SAPReply node as a message tree structure. The adapter then sends back the export parameters to the calling SAP program. In this case, the SAPReply node is typically in the same flow as the SAPInput node. The SAPInput node provides a unique ID (the reply identifier) for each BAPI call. The reply identifier is propagated to the SAPReply node (in the local environment) to indicate to which BAPI call it is replying.

If no reply identifier exists in the local environment, the SAPReply node automatically uses the reply identifier from the SAPInput node that triggered the current execution of the message flow. If the flow is triggered by anything but an SAPInput node, or if a break occurs in the flow, an error is issued. An unhandled exception in the message flow causes a system failure in SAP.

Even if the BAPI does not expect any output parameters, the (empty) message must be propagated to the SAPReply node.

You can process two concurrent callouts from SAP by configuring the message flow with an additional instance.

Scenario 1

The following diagram represents a message flow where IBM App Connect Enterprise provides a link between SAP and a target application (in this case, DB2®) The SAP program requires reply data, therefore it blocks further processing until the call completes.

The diagram illustrates the following steps.
  1. The SAP program makes a BAPI call to IBM App Connect Enterprise.
  2. IBM App Connect Enterprise converts the call to an SQL call.
  3. IBM App Connect Enterprise passes the call on to Db2.
  4. Db2 processes the SQL and returns the result to IBM App Connect Enterprise.
  5. IBM App Connect Enterprise converts the SQL result to a BAPI reply and sends the reply to SAP.
  6. The SAP program processes the next line of code.

Scenario 2

The following diagram also represents a message flow where the SAP program requires reply data, but in this scenario, calls between IBM App Connect Enterprise and the target application (in this case, IBM MQ) are asynchronous. The SAP system blocks further processing until the call completes. If the value of the SAP Maximum client wait time property is insufficient, or if it is set to 0, then a timeout error might be generated. For more information about the Maximum client wait time property of the SAP Input Node, see Maximum client wait time (secs). When you use the SAPReply node in a different flow from the SAPInput node, deploy the SAPReply node in the same integration server as the SAPInput node.

The diagram illustrates the following steps.
  1. The SAP program makes a BAPI call to IBM App Connect Enterprise.
  2. IBM App Connect Enterprise converts the import parameters into a message format that is understood by the target application.
  3. IBM App Connect Enterprise puts that message on a request queue.
  4. The target application gets the request message from the queue, processes it, and puts a reply message on the reply-to queue.
  5. IBM App Connect Enterprise gets the reply message from the queue.
  6. IBM App Connect Enterprise converts the reply message to BAPI export parameters and sends the reply to SAP.

Scenario 3

The following diagram represents an asynchronous call from SAP to IBM App Connect Enterprise, and an asynchronous call from IBM App Connect Enterprise to a target application. This scenario shows how you can combine the inbound processing that is described in this topic with outbound processing to achieve the same result as in scenarios 1 and 2. For more information about outbound processing, see Outbound processing for the BAPI interface.

The diagram illustrates the following steps.
  1. The SAP program makes a BAPI call to IBM App Connect Enterprise, stores relevant information in a database table, and continues to process the next line of code.
  2. IBM App Connect Enterprise converts the import parameters into a message format that is understood by the target application.
  3. IBM App Connect Enterprise puts that message on a request queue.
  4. The target application gets the request message from the queue and processes it.
  5. IBM App Connect Enterprise gets the reply message from the queue.
  6. The SAPRequest node sends the message to the SAP program, requesting an update in SAP.
  7. The SAP program refers to the information that is stored in the database table and makes the requested update.

Errors and warnings

  • If an SAPReply node is deployed but no SAPInput node is deployed to that integration server, a warning is written to syslog or the Windows Event Viewer.
  • If the SAPReply node is provided with a reply identifier that does not correspond to any BAPI call in this integration server, an error is issued.
  • If the same reply identifier is sent to two SAPReply nodes, the second node receives an error message.
  • If an SAP program tries to call a BAPI that is using the RFCDestination value of the integration node, but that BAPI was not discovered for that adapter, an error is written to syslog or the Windows Event Viewer, and a failure message is sent back to the calling SAP program.