ABAP Keyword Documentation →  ABAP Programming Guidelines →  Architecture →  Data Storage → 

Database Accesses

Background

In ABAP, data in database tables can be accessed in the following ways:

All access types enable access, not only to the central database of an AS ABAP (standard connection), but also to other databases, using additional connections.

Rule

Using Open SQL

Use Open SQL for general persistence services where possible. Only use Native SQL for tasks where Open SQL is not suitable.

Details

Only Open SQL is guaranteed to be independent of the database platform used. For this reason, Open SQL does not contain the set of all possible SQL statements in a specific database, but only a subset of the DML scope of all database systems supported by AS ABAP. The database tables that can be processed using Open SQL can be used in ABAP directly as structured types for the declaration of suitable work areas. Only Open SQL supports SAP buffering of table content in the shared memory.

Native SQL should only be used if the task really cannot be solved using Open SQL. Services that work with Native SQL are generally dependent on the database system used, so that they cannot be executed in all AS ABAP systems. For platform-independent services, implementations should be provided for all supported databases.

If the database is to be accessed using the Native SQL interface instead if the Open SQL interface, ADBC should be used. ADBC is a modern object-oriented API that is better suited to modern ABAP programming than EXEC SQL. Enhancements to the Native SQL interface, such as bulk access using internal tables, are now only provided using ADBC. ADBC also enables dynamic access; Native SQL on the other hand is just static.