WebSphere Adapter for SAP

BAPI transactions

A BAPI transaction, also referred to as a BAPI Logical Unit of Work, consists of a set of BAPIs that are executed in sequence to complete the entire transaction.

For example, to update an employee record in the SAP system, the record needs to be locked before being updated. This is accomplished by calling three BAPIs, in sequence, in the same transaction. The following three BAPIs illustrate the kind of sequence that forms such a transaction:
  • BAPI_ADDRESSEMP_REQUEST
  • BAPI_ADDRESSEMP_CHANGE
  • BAPI_ADDRESSEMP_APPROVE

The first BAPI in the transaction locks the employee record, the second updates the record, and the third approves the update. The advantage of using a transaction is that the client can invoke the employee record change with a single call, rather than with three separate calls. In addition, if SAP requires that the BAPIs execute in a specific sequence for the business flow to complete correctly, the transaction supports this sequence.

The adapter supports a BAPI transaction, or sequence of BAPIs, using a top-level wrapper business object that consists of multiple child BAPIs, each one representing a simple BAPI in the 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 simple parameters of the method. The adapter uses the application specific information set on the operation to determine the sequence of BAPI calls. BAPI_TRANSACTION_COMMIT can be issued after each BAPI call by specifying the keyword COMMIT in the ASI sequence. The adapter calls BAPI_TRANSACTION_COMMIT at the end of a sequence of BAPI calls even if the application specific information sequence does not specify any COMMITs.

The adapter does not provide an automated rollback mechanism for BAPI transactions. Rollback of a BAPI transaction can be achieved in one of the following ways:

  • Do not put explicit COMMITs in the application specific information sequence. When an error occurs in one of the BAPIs, the sequence of BAPI calls is terminated and BAPI_TRANSACTION_ROLLBACK is called. If there is no intrinsic COMMIT in any of the BAPIs already called, no further steps are required. Most BAPIs do not have an intrinsic COMMIT.
  • Call another BAPI that can compensate for the work that is already committed, as in the case of the BAPIs that have an intrinsic COMMIT.

Terms of use |

Last updated: Thu 12 Oct 2006 03:34:39

(c) Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)