Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses 

Native SQL

The term Native SQL refers to all statements and calls that can be passed to the Native SQL interface of the database interface. Native SQL can be passed to the database interface as follows:

  • Dynamically using objects from the ADBC classes
  • Statically as database procedures managed by ABAP, using AMDP

Both ADBC and AMDP are recommended. New developments and improvements, such as optimized performance using bulk access across internal tables, are now made only for ADBC and AMDP. The existing static embedding of Native SQL statements between EXEC SQL and ENDEXEC is still supported but should no longer be used in new programs.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • When using Native SQL, the order of the columns in database tables defined in ABAP Dictionary in the database system does not match the order of the structure definition in ABAP Dictionary. When using Open SQL, this is handled accordingly in the database interface and the order in ABAP Dictionary always applies. When using Native SQL, the order of the columns in the database system must be applied explicitly.

  • Special care must be taken when using Native SQL to pass data from ABAP to the database system and back. This applies both when using ABAP data objects as host variables or bound parameters in Native SQL statements and when binding ABAP data object to the parameter interface of stored procedures or database procedures. Not all predefined ABAP types have corresponding types in the type system of the database system in question. When using Open SQL the required mapping is defined in ABAP Dictionary and performed by the Open SQL interface. In Native SQL, on the other hand, this is the responsibility of the developer. This is particularly relevant for the ABAP types n, d, and t and decimal floating point numbers.

  • Native SQL does not support automatic client handling. When accessing client-specific database tables or views, the required client ID must be selected explicitly. In application programs, only the current client should be used to do this.

Programming Guideline

Using Open SQL

Continue

ADBC - ABAP Database Connectivity

AMDP - ABAP Managed Database Procedures

EXEC SQL - Embedded Native SQL