Some BAPI remote functions commit database changes, but some don’t have a commit implemented in their code. By default, OutSystems creates a new transaction for each SAP remote function call, and commits changes before closing it.
However, there are situations where you need to make several calls to SAP remote functions in the same transaction.
To achieve this, you need an extension module to manage stateful calls in SAP.
Create an Extension Module Using SAP Extensibility API
Use the Extension in your Application
To implement stateful calls in your application do the following:
- Add dependencies to the following actions of the SAPUtilities extension:
- BeginContext: starts a stateful connection in SAP
- EndContext: ends the stateful connection in SAP
- Commit: commits changes inside a stateful connection in SAP
- Rollback: rolls back changes inside a stateful connection in SAP
- Use SAP remote functions together with the actions from the extension to implement a stateful call.