Try OpenEdge Now
skip to main content
Developing AppServer Applications
Programming the AppServer : Managing transactions : Implementing automatic transactions : Terminating automatic transactions
 
Terminating automatic transactions
An automatic transaction remains active as long as the context of the transaction initiating procedure remains active and you do not otherwise terminate the transaction using a transaction handle method. Thus, you can terminate an automatic transaction using the following two techniques:
*Explicit termination — You can explicitly terminate an automatic transaction on the AppServer with a reference to the SET-COMMIT( ) method or the SET-ROLLBACK( ) method, as shown:
hTran = THIS-PROCEDURE:TRANSACTION.
hTran:SET-COMMIT().
hTran = THIS-PROCEDURE:TRANSACTION.
hTran:SET-ROLLBACK().
As long as an automatic transaction is open, you can execute any internal procedure of the transaction initiating procedure from any other procedure running in the AppServer session. However, if no transaction is open, any such attempt to call these internal procedures from within the AppServer agent context returns an error. Without an open transaction, only a client application can call a remote internal procedure of the transaction initiating procedure (see Restartingautomatic transactions for more information).
Note: You can determine whether an automatic transaction is open in an AppServer session by either checking for an error after executing an internal procedure of the transaction initiating procedure or by checking the value of the TRANS-INIT-PROCEDURE attribute.
*Implicit termination — You can also terminate the automatic transaction from either the client or the AppServer session by deleting the proxy procedure handle (on an ABL client) or remote persistent procedure handle (on the AppServer) of the transaction initiating procedure. If you delete the transaction initiating procedure, the transaction commits or rolls back depending on the value of the transaction handle DEFAULT-COMMIT attribute.