Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  Data Consistency →  Database LUW 

COMMIT, ROLLBACK CONNECTION

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


COMMIT|ROLLBACK CONNECTION con|(con_syntax). 

Effect

This COMMIT or ROLLBACK statement performs a database commit or database rollback on the specified database connection. The database connection can be specified as follows:

  • con
Specified directly and statically as con.
  • (con_syntax)
Specified as the content of a parenthesized data object con_syntax of type c or string.

The following can be specified for con or in con_syntax (and transformed to uppercase letters internally):

  • default specified statically or DEFAULT specified dynamically for the standard connection of the current work process.
  • The name of secondary connection specified statically or dynamically. The name must exist in the column CON_NAME of the database table DBCON.
  • The name of a service connection to the standard database specified statically or dynamically. The name of the service connection must consist of the prefix R/3* followed by any 26 alphanumeric characters (in uppercase).
  • A name (in uppercase letters) granted for a secondary connection or service connection by the addition AS of the static Native SQL statement CONNECT TO. It should be noted here that a connection with a name of this type is a separate database connection that can exist in parallel with a connection not named using AS.


Notes

  • It should also be noted that the statements COMMIT CONNECTION default and ROLLBACK CONNECTION default perform a clean database commit or rollback on the standard connection, unlike COMMIT WORK and ROLLBACK WORK. They do not close the current SAP LUW.
  • The statements COMMIT CONNECTION and ROLLBACK CONNECTION are suitable for a simple close of a database LUW. If database LUWs are monitored by the application log, the function modules DB_COMMIT and DB_ROLLBACK are better suited to raising an appropriate event.
  • COMMIT CONNECTION and ROLLBACK CONNECTION can only be used to edit connections activated in Native SQL or AMDP if their names do not contain any lowercase letters. This affects service connections and names defined using the addition AS of the statement CONNECT TO. The names of secondary connections do not contain any lowercase letters.
  • The statements COMMIT CONNECTION and ROLLBACK CONNECTION clear global temporary tables on the specified secondary connection and prevent the runtime error COMMIT_GTT_ERROR in implicit database commits on this connection.
  • The statements COMMIT CONNECTION and ROLLBACK CONNECTION change the state of an active secondary connection or service connection to inactive. The way the following connection is used in the same internal session opens a new database LUW.
  • Detailed information about database connections can be found here.

Example

Performs a database commit and releases the exclusive lock after modifying ABAP SQL statements by using COMMIT CONNECTION default on the standard connection.

DELETE FROM demo_expressions. 
INSERT demo_expressions FROM @( VALUE #( id = 'X' ) ). 
COMMIT CONNECTION default.