Transaction plays a very important role in the SAP world and often times you would run into SAP BAPI’s which will not commit data till the transaction has been terminated properly. In this article I am going to cover how to call a SAP BAPI which needs to be part of transaction.
Before we begin, one key thing to remember is that when you create a SAP connection using AgilePoint SAP Connector which is to be used in a transaction, always make sure it is on type “User Authentication” i.e. you will need to configure a Connection Pool with User Authentication instead of Anonymous mode.
There is no way to reliably queue the transactions in anonymous mode since the connection handles given to the application can vary between transactions.
In order to effectively queue the transactions with the Connector, the calling app needs to pass in the credentials with every transaction so use connection pool of type user and give credential in access token
The connection pool setting might look as following screenshot
Also the corresponding access token which you create in AgilePoint process model might look similar to the one shown below. Please note that since I indicated that connection pool uses user authentication, while configuring access token, it would ask me to enter service account username and password
With that step completed, you should be able to configure your process model to call the SAP BAPI under same transaction. Here is how it is achieved
AgilePoint NX SAP activity group has workflow activities for handling the transaction
Firstly you would design the process model in a way that it wraps the actual BAPI call between start and end transaction.
On each of SAP activity, there is a field called “Transaction Name”. For them to be considered as part of same transaction, all shapes need to have same transaction name as indicated below
Begin SAP Transaction
Call SAP BAPI Configuration
End SAP Transaction
With the above mentioned configuration, you would be successfully able to call a SAP BAPI under same transaction.