ABAP Keyword Documentation → ABAP − Reference → Processing External Data → ABAP Database Access → Data Consistency → Database LUW
COMMIT, ROLLBACK CONNECTION
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
con
.
-
(con_syntax)
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 usingAS
.
Notes
-
It should also be noted that the statements
COMMIT CONNECTION default
andROLLBACK CONNECTION default
perform a clean database commit or rollback on the standard connection, unlike COMMIT WORK andROLLBACK WORK
. They do not close the current SAP LUW. -
The statements
COMMIT CONNECTION
andROLLBACK 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
andROLLBACK 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 additionAS
of the statementCONNECT TO
. The names of secondary connections do not contain any lowercase letters. -
The statements
COMMIT CONNECTION
andROLLBACK 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
andROLLBACK 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.