Show TOC

RfcInstallTransactionHandlersLocate this document in the navigation structure

Use

Installs the necessary callback function for being able to process incoming tRFC/qRFC calls.

Process

  1. The RFC_ON_CHECK_TRANSACTION function is called when a local transaction is starting. Since a transactional RFC call can be issued many times by the client system, the function is responsible for storing the transaction ID in permanent storage. The return value should be one of the following:

    • RFC_OK

      Transaction ID stored, transaction can be started.

    • RFC_EXECUTED

      This transaction has already been processed successfully in an earlier attempt. Skip the execution now.

    • RFC_EXTERNAL_FAILURE

      Currently unable to access my permanent storage. Raise an exception in the sending system, so that the sending system will try to resend the transaction at a later time.

  2. The next step will be the execution of the RFC_SERVER_FUNCTION for that particular function module.

  3. Depending on the result of the RFC_SERVER_FUNCTION implementation, next one of RFC_ON_COMMIT_TRANSACTION or RFC_ON_ROLLBACK_TRANSACTION is called. Do a COMMIT WORK or ROLLBACK WORK here, so that the changes, which the RFC_SERVER_FUNCTION made, are now either persisted or rolled back.

  4. In the end RFC_ON_CONFIRM_TRANSACTION will be called. All information stored about that transaction can now be discarded by the server, as it no longer needs to protect itself against duplicates.

    In general this function can be used to delete the transaction ID from permanent storage.

Structure

RFC_RC SAP_API RfcInstallTransactionHandlers (SAP_UC const *sysId, RFC_ON_CHECK_TRANSACTION onCheckFunction, RFC_ON_COMMIT_TRANSACTION onCommitFunction, RFC_ON_ROLLBACK_TRANSACTION onRollbackFunction, RFC_ON_CONFIRM_TRANSACTION onConfirmFunction, RFC_ERROR_INFO* errorInfo);