RfcInstallTransactionControl

This function installs four functions to control transactional behaviour. It is only to be used with transactional RFC. The syntax is:

void SAP_API RfcInstallTransactionControl
(RFC_ON_CHECK_TID onCheckTid,
RFC_ON_COMMIT onCommit,
RFC_ON_ROLLBACK onRollback,
RFC_ON_CONFIRM_TID onConfirmTid)

This function was introduced to allow an RFC server program to ensure exactly-once behaviour for functions being called via tRFC in ABAP: RfcInstallTransactionControl must thus be called by RFC server program before the RfcDispatch loop is entered if this program wants to receive transactional RFC calls and must ensure that RFC calls are done excatly once.

Without installing these functions it can only be guaranteed that an RFC function call issued by 'Call Function... In Background Task' is done at least once. Then all function modules offered by such a server program which are called via 'Call Function... In Background Task' must cope with being called more then once.

If installed, the first function onCheckTid is called, if a transactional RFC is to be called. The actual Transaction ID is passed ( RFC_ON_CHECK_TID). The function has to store this transaction-ID in permanent storage and return 0. If the same function will be called later again with the same transaction-ID, it has to make sure that it will return a non-zero value. If the same transaction is already running by another process but is not completed, the function has to wait until the transaction completes.

The second function is called if all the RFC function module calls are done and the local transaction can be completed. It should be used to locally commit the transaction, if necessary ( RFC_ON_COMMIT). This function is 'void'.

The third function is called instead of the second function, if, from the point of view of the RFC library, there occurred an error while processing the local transaction. This function can be used to roll back the local transaction ( RFC_ON_ROLLBACK). This function is 'void'.

The fourth function will be called if the local transaction is completed also from the point of view of the calling system and all information on this transaction-ID can be discarded. This function is 'void': RFC_ON_CONFIRM_TID.

This function is defined in SAPRFC.H.

Function Parameters:

  • onCheckTid

Function to be called when local transaction starts. Must be used to check if the transaction is already running or was already completed.

  • onCommit

Function to be called when local transaction ends. Should be used to commit the transaction locally.

  • onRollback

Function to be called if local transaction fails due to an error found while the processing is done inside the RFC library. Should be used to roll back a local transaction.

  • onConfirmTid

Function to be called when local transaction is confirmed. All information stored locally about this transaction can be deleted.

See also RFC_TID.