The following sections explain a simple example implementation of the tRFC callback interface TRXLogging:

The semantic of this interface is described in tRFC Service. However, the current example does not manage TIDs properly, but just logs the transaction ID to the file system. This is done purely for educational purposes enabling the modeler to observe the transactional behavior of the SAP system.

If the transaction functions are not implemented the server will always call the default handlers that return always RFC_OK. This means, for the SAP system seems everything to be fine even without any TID management at all. Thus, it is crucial to have a proper implementation of the transaction interfaces.

onCheckTID

This function will be activated, if a transactional RFC is called from an SAP system. The current TID (Transaction ID) has been handed over to the function. The function has to store this TID in permanent storage and return 0. If the same TID will be called later again, it must return a value <> 0.

The status is returned using the object flow state called status. If status is not used, the Bridge returns

  • 0, if no error occurred
  • -1, if an unhandled exception occurred

Figure: Simple Example of onCheckTID

onCommit

This function will be called, if all RFC functions belonging to this transaction, are done and the local transaction can be completed. It should be used to locally commit the transaction, if working with database.

Figure: Simple Example of onCommit

onRollback

This function is called instead of the second function (onCommit), if an error occurs in the RFC library while processing the local transaction. This function can be used to roll back the local transaction (working with database).

Figure: Simple Example of onRollback

onConfirmTID

This function will be called, if the local transaction is completed. All information about this TID can be deleted.

Figure: Simple Example of onConfirmTID

On this Page:
Related Pages:
  • No labels