ADBC is recommended. New developments and improvements, such as support for new SQL statements or optimized
performance using bulk access across internal tables, are now made only for ADBC. 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.
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 built-in ABAP types have corresponding types in the type system of the
database system in question. Although types from the ABAP Dictionary can be mapped to ABAP types and
the appropriate conversions can be executed from the Open SQL interface when using Open SQL, when using Native SQL only matching data types should be
mapped and conversions should be avoided.
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.
When the CDS database view of a
client-specific CDS view is accessed using Native
SQL and the client handling of the view is specified by the annotation @ClientHandling.algorithm:#SESSION_VARIABLE, the
session variable$session.client is generally evaluated here. Only on
SAP HANA databases, is
an instance of this session variable is created as a HANA session variable CDS_CLIENT. Its current value is used here. On other platforms, there can be unexpected behavior or the program may crash.
Alongside their differences in syntax, Native SQL statements can behave in different ways on different platforms (particularly when compared with Open SQL). This mainly affects the following:
Handling of blanks in strings
Calculation rules and roundings in arithmetic calculations
Overflow behavior
More information about the behavior in question can be found in the documentation of the vendor-specific Native SQL.