Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  Data Consistency →  Database LUW 

Database Commit

In AS ABAP, database commits are triggered either implicitly or explicitly.

Other versions: 7.31 | 7.40 | 7.54


Note

A database commit closes all opened database cursors. It is particularly important that database commits are not triggered (in one of the ways listed here) in SELECT loops and after the statement OPEN CURSOR.

Implicit Database Commits

The implicit database commits in an AS ABAP are caused by the fact that an AS ABAP uses its own work processes to connect to the database system. A work process can only ever execute a single database LUW but cannot interfere with the database LUWs belonging to other work processes. Since an ABAP program can be executed by different work processes during its runtime, the database LUW for the current work process must be completed each time an action takes place that leads to a change of work process. As a result, a database commit is performed implicitly in the following situation:

  • Completion of a dialog step

    The program waits for a user action and does not occupy a work process during this time. The next free work process is assigned to the program in the next dialog step.
  • Calling a function module in a synchronous or asynchronous remote function call

    The current work process passes control to a different work process or system. An exception to this are updates. When updates are running, sRFC and aRFC do not cause work processes to be switched or database commits to be executed.
  • Completion of a function module called in a separate work process using a synchronous remote function call.

    Usually, a new work process is allocated to the call program. If a new sRFC follows quickly enough, and enough free work processes exist, the work process sRFC continues to be used, but an implicit database commit is performed regardless.
  • Execution of the statement RECEIVE in a callback routine specified in an asynchronous RFC

    To receive data from the other application server, the current work process must be interrupted before the callback routine is executed A database commit is performed, except during the update.
  • HTTP/HTTPS/SMTP communication executed using Internet Communication Framework

    A database commit is executed before each response is sent in an ICF server program or ICF client program. An exception to this are updates. This behavior applies regardless of whether the communication is stateless or stateful.
  • Receiving messages from ABAP messaging channels

    A database commit is executed while the methods START_MESSAGE_DELIVERY and STOP_MESSAGE_DELIVERY of a consumer object are being executed.
  • WebSocket communication using ABAP push channels

    Each time a message is sent and the APC exited, a database commit is executed to handled messages. An exception to this are updates. The methods BIND_AMC_MESSAGE_CONSUMER and UNBIND_AMC_MESSAGE_CONSUMER (for connecting an ABAP messaging channel) in particular result in a database commit.

Explicit Database Commits

Database commits can be triggered explicitly in ABAP programs in the following ways:

  • The relevant database-specific Native SQL statement is used.
  • In ADBC, only the corresponding methods of the class CL_SQL_CONNECTION can be used to do this. In other cases, the database interface does not detect the end of the transaction and might not be able to perform certain actions.
  • Transaction-control statements embedded statically between EXEC and ENDEXEC (COMMIT, ROLLBACK) are detected by the database interface and any required actions performed.
  • Calling the function module DB_COMMIT.

    This function module, which has no parameters, encapsulates the corresponding Native SQL statement.