About Application Adapters

About Sun Adapter for SAP BAPI

This topic provides conceptual information about SAP BAPI and its Sun Java CAPS Adapter.

About SAP

SAP creates software for the Enterprise Resource Planning (ERP) business sector. The company main product is SAP R/3 which uses a three-tier application architecture—database, application server, and client—to facilitate real-time data processing.

About the SAP BAPI Adapter

The SAP BAPI Adapter enables Java CAPS Projects to exchange data with SAP R/3 software using Business Application Programming Interfaces (BAPIs), RFCs, and IDocs.

The SAP BAPI Adapter uses the SAP Java Connector (SAP JCo) to allow Java applications to access BAPIs and RFCs.

The functionality of the SAP BAPI Adapter simplifies the process of determining the requisite IMPORT, EXPORT, CHANGING, and TABLE parameters—collecting all the necessary data using the correct type and format, calling the Remote Function Module (RFM) that represents the BAPI, and then extracting and parsing data from the EXPORT and/or TABLE parameters.

Before it can be invoked, a BAPI or RFM requires the following parameters:

The detailed metadata for these parameters such as descriptions of their value types and mandatory or optional nature, can be found under SAP transaction SE37.

The meta data for a BAPI/RFC in SAP R/3 is extracted by the BAPI wizard, which uses it to build the BAPI/RFC OTD. This OTD is used in Java Collaborations and eInsight Business Processes to invoke or receive the BAPI/RFC call.

The SAP BAPI Adapter Data Flows

When the SAP BAPI Adapter communicates with the SAP R/3 software, it uses the RFC protocol. The list below shows the RFC types of communication used:

Outbound Data Flow: Java CAPS to SAP R/3

Outbound communications occur when the Adapter receives data from Java CAPS and sends it to SAP R/3 by calling a specific BAPI or RFM. The figure below shows a non-transactional outbound process.

The figure above shows the following steps for the outbound data flow:

  1. The Collaboration or Business Process populates the appropriate BAPI or RFC Import, Changing, and Table parameter nodes on the BAPI/RFC OTD with data from an inbound OTD.

  2. The Adapter logs onto the SAP R/3 application using preconfigured properties.

  3. The Adapter calls the BAPI OTD’s execute() method. Any work performed is immediately committed by SAP R/3 through autocommit.

  4. The SAP R/3 applications returns successfully.

Inbound Data Flow: SAP R/3 to Java CAPS

For the inbound data flow, the SAP BAPI Adapter can receive data from SAP R/3 via RFC or tRFC. The sections below describe each protocol.

To enable the SAP BAPI Adapter to receive data from SAP R/3, configure the Environment properties with an RFC destination created within SAP R/3.

Inbound Data Flow via RFC

The sequence diagram uses a sample CostCenter OTD to describe the RFC inbound sequence.

The figure above shows the following steps for the inbound data flow via RFC:

  1. The Business Process is activated when an RFM call is received from SAP R/3.

  2. Finding that data from an RFM is available, the Business Process accesses all pertinent data nodes and sends the gathered information to other Java CAPS components.

  3. The Adapter returns the results of the RFM execution back to SAP.

Inbound Data Flow via tRFC

Communication via tRFC is the similar to RFC, except that it adds transactional verification steps prior to committing or rolling back. tRFC is preferred over RFC because of the additional reliability. By using unique TIDs associated with a BAPI/RFM call, SAP R/3 processes the data once, and only once. The figure below shows inbound data flow via tRFC.

The figure above shows the following steps for the inbound data flow via tRFC:

  1. The Business Process is activated when an RFM call is received from SAP R/3.

  2. Finding that data from an RFM is available, the Business Process accesses all pertinent data nodes and sends the gathered information to other Java CAPS components.

  3. The Adapter returns the results of the RFM execution back to SAP R/3.

  4. If the RFM call returned successfully without exceptions, SAP R/3 informs the Adapter that the data can be committed by calling onCommitTID().

  5. The Adapter updates the TID in the file database as being Committed, commits the data, and sends an onCommitTID() return to SAP R/3.

  6. If the RFM call did not return successfully for any reason, SAP R/3 informs the Adapter that the data must be rolled back by calling onRollbackTID().

  7. The Adapter sends an onRollbackTID() return to SAP R/3, confirming that the TID was not committed.