How the BAPI Module works

The BAPI Module implements the init(), terminate(), pollForEvents(), and the doVerbFor() method. However, the pollForEvents() method is not used because the BAPI Module supports request operations only.

Initialization and termination

The init() method opens an RFC connection with the SAP application through the SAP Gateway. If the connector fails to initialize, it terminates using the terminate() method. The connector terminates by disconnecting the connection to the SAP Gateway.

Business object processing

A single implementation of the doVerbFor() method in the vision connector framework's business object handler initiates all business object requests. The vision business object handler processes all of the business objects passed between the BAPI Module and the integration broker. In the BAPI Module, a single BAPI business object handler supports all BAPI calls.

Figure 47 illustrates business object processing for the BAPI Module.

Figure 47. Business object processing for the BAPI Module


Once invoked by the Vision business object handler, the BAPI business object handler executes in the following manner:

  1. Receives the WebSphere business object for SAP from the Vision business object handler.
  2. Populates the BAPI parameters with business object data.
  3. Executes a BAPI call using RFC and passes the BAPI parameters to the SAP application. The business object handler waits for the business object data to be returned.
  4. Receives the business object data (BAPI parameters).
  5. Converts the BAPI parameters back to WebSphere business object data.
  6. Passes the business object to the Vision business object handler and ultimately to the integration broker.

Note:
If a BAPI Module has a Return Structure or Return Table, the connector checks for the message types A (abort) and E (error) to determine if the event processed successfully. A message type A or E indicates that the event failed to process. If a BAPI does not have a Return Structure or Return Table, you must implement your own error handling. When a message broker is the integration broker, events that fail in the Connector Framework are moved to the fault queue; events that fail in the message broker environment are handled by the MQ message flow. When InterChange Server (ICS) is the integration broker, you can resubmit failed events using WebSphere InterChange Server System Manager (CSM).

Supporting BAPIs

IBM WebSphere Business Integration Adapter for mySAP.com includes a tool, SAPODA, that generates business object definitions that support BAPIs. SAPODA interprets the interface of a BAPI, maps its parameters to the business object attributes, and adds the application-specific information for each attribute.

Note:
Some BAPIs do not have single field parameters that correspond to simple attributes in the WebSphere business object. The connector requires every top-level business object to have a simple attribute that serves as the key attribute. Therefore, when generating a business object and business object handler from a BAPI without a single field parameter, SAPODA creates a key attribute named Dummy_key in the top-level business object, marks it as the key attribute, and adds dummy_key as the application-specific information of this attribute. Dummy_key provides the connector with a key attribute so that it can process the business object. However, the connector ignores the value of the Dummy_key attribute when modifying application data.

Supporting BAPI transactions

The connector and SAPODA support SAP BAPI transactions (also referred to as Logical Units of Work). A BAPI transaction consists of a set of BAPIs that are executed in a sequence so as to complete the entire transaction. The sequence of multiple BAPIs is invoked using the same JCo client connection.

To support BAPI transactions, SAPODA generates a top-level business object that acts as a wrapper of a set of child business objects, each one representing a single BAPI call in the transaction sequence. The BAPI transaction wrapper object represents the complete transaction. Each second-level child business object represents a structure parameter or table parameter of the method. Simple attributes correspond to the simple parameters of the method.

The BAPI business object handler returns SUCCESS when all the BAPI calls in the transaction process successfully. The business object handler also provides error handling in case of failures. If a BAPI call in the transaction fails processing, the subsequent calls in the transaction terminate and, depending on the error code, BAPI_RETURN returns either FAIL or APPRESPONSETIMEOUT.

The BAPI interface does not provide a rollback mechanism for transactions. You can achieve rollback in one of the following ways:

Note that rollback needs to be handled by the business process logic.

For details about the strucutre of BAPI transaction business objects, see Developing business objects for the BAPI Module.

Supporting BAPI ResultSets

The connector and SAPODA provide ResultSet support for DB2 Information Integrator (DB2 II). SAPODA generates a ResultSet object that is a wrapper business object. This object contains two attributes, BAPI_Query and BAPI_Result, that represent Query BAPI and Result BAPI objects. For details about the structure of BAPI ResultSet objects, see Business object structure for BAPI ResultSets.

Copyright IBM Corp. 1997, 2004