Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP - Database Accesses →  Open SQL →  Open SQL - Overview 

Open SQL - General

Other versions: 7.31 | 7.40 | 7.54

Scope of Open SQL

Open SQL defines the subset of ABAP statements that enable direct access to data from the central database of the current AS ABAP. The Open SQL statements form the DML part of SQL in ABAP, which is supported by all database systems.

We differentiate between:

Database Interface

The statements of Open SQL are converted to database-specific SQL in the Open SQL interface of the database interface. They are then transferred to the database system and executed there. Open SQL statements can be used exclusively to access database tables that are declared in the ABAP Dictionary. It is also possible to access these using views.

By default, the central database of the AS ABAP is accessed. It is also possible to access other databases using secondary database connections.

Database Access

Each Open SQL statement is synonymous with an access to the database. This applies in particular with SELECT statements that end in ENDSELECT. Data to be read and to be modified is transported in packages between the database server and the current application server. You can configure the size of the packages using profile parameters (for example, the default value for Oracle is 65 KB). The number of characters that can be transported in one package depends on whether the system is a Unicode system or a non-Unicode system.

To improve performance when accessing the database, you can activate SAP buffering to avoid accessing the database directly each time.

If more than approximately 2^32 entries are addressed in a single database access, the behavior of the database is undefined.

Client Handling

Open SQL works with automatic client handling that always accesses the current client. The current client is the content of the system field sy-mandt.

When client-specific database tables are accessed, the client identifier cannot be explicitly specified in WHERE conditions, or it is ignored by entries in work areas of modifying statements. You can switch off automatic client handling using the addition CLIENT SPECIFIED.


Notes

  • The client data from an AS ABAP is depicted in closed units. No cross-client access to databases should take place in application programs. For this reason, the addition CLIENT SPECIFIED should never be used and no access to sy-mandt should take place.

  • True multitenancy, with which the system ensures that different tenants' application data is isolated from each other, is not supported by the ABAP runtime environment in the current release.

LUW

When using the modifying statements (INSERT, UPDATE, MODIFY, and DELETE), it is important to keep data storage consistent. The LUW concept is designed for this purpose. In application programs of an AS ABAP, the implicit database LUWs are normally not sufficient for consistent data storage. Instead, you need to program explicit SAP LUWs, which normally contain several database LUWs (refer to the section on data consistency).

Performance

More information: Performance Advice for Open SQL.