Rollback Transaction
Call this system function to cancel all the database operations started since the Begin Transaction and the End Transaction. This system function takes a MathNumeric type parameter called Transaction ID. Use the same variable as used in Begin Transaction. The EnterpriseOne will end the transaction without committing any database operations started between the Begin Transaction and Rollback Transaction calls. You should only use this system function when absolutely necessary.
System Variable - SV TP Commit Status
This system variable tells you the status of the Commit Transaction or Rollback Transaction call. It may contain one of the four valid values:
CO TP_ACTION_FAIL
If SV TP Commit Status is equal to CO TP_ACTION_FAIL, then the last transaction action has failed. The last transaction action can be either Commit Transaction or Rollback Transaction. If the last transaction is Commit Transaction then the Commit Transaction has failed and no database operation has been committed. If the last transaction is Rollback Transaction, then the rollback operation has failed. No database records have been committed.
CO TP_ACTION_SUCCESS
If SV TP Commit Status is equal to CO TP_ACTION_SUCCESS, then the last transaction action has succeeded. The last transaction action can be either Commit Transaction or Rollback Transaction. If the last transaction is Commit Transaction, then the commit has succeeded and all database operations have been committed. If the last transaction is Rollback Transaction, then the rollback operation has succeeded.
CO TP_IN_TRANSACTION
If SV TP Commit Status is equal to CO TP_IN_TRANSACTION, then the transaction has been started, but no Commit Transaction or Rollback Transaction system function has been called yet.
CO TP_NO_TRANSACTION
If SV TP Commit Status is equal to CO TP_NO_TRANSACTION, then the no transaction has not been started or completed by the Transaction Processing system functions.
Event Rules Sample Using System Variable TP_Commit_Status
Begin Transaction (transaction ID) Table IO_Open Table 1 Table IO_Insert Table 1 Table IO_Open Table 2 Table IO_Open Table 2 Business function inserts into Table 3 in a separate transaction. Commit Transaction (transaction ID) if (SV TP_Commit_Status is equal to CO TP_ACTION_FAIL) { // this means the transaction failed (system has rolled it back) // call another Business Function to roll back Table 3 since Table 3 Insert // is done outside of current transaction } else { // notify user transaction successful