After having been connected to an SAP system (using RfcOpenConnection), an RFC client program must use the following two RFC calls to work with the tRFC interface:
With this call, the RFC library tries to get a TID created by the SAP system. If errors occur, the RFC client program has to reconnect later and must try to repeat this call. Otherwise, the RFC client program can assign this TID with the RFC data, and if the next call is not successful, it can be repeated later.
With this call, the RFC library packs all RFC data belonging to an RFC function together with the TID and sends them to the SAP system using the tRFC protocol. If an error occurs, the RFC client program has to reconnect later and must try to repeat this RFC call ( RfcInvokeInTransaction). In this case, it has to use the old TID and must not get a new TID with RfcGetTransactionID. Otherwise, there is no guarantee that this RFC function will be executed exactly once in the SAP system. After this call is executed successfully, the transaction will be completed once and for all. The RFC client program can then update its own TID management (for example, delete the TID entry).
Contrary to tRFC between SAP systems, a transaction from an RFC client program contains only one RFC function.