Ansicht
Dokumentation

ABENNATIVE_SQL - NATIVE SQL

ABENNATIVE_SQL - NATIVE SQL

BAL_S_LOG - Application Log: Log header data   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Native SQL

The term Native SQL refers to all platform-dependent statements and calls that can be passed to the Native SQL interface of the database interface. By default, the standard connection is used to access the ABAP database schema of the standard AS ABAP database.

Native SQL can be passed to the database interface as follows:

  • In strings passed to objects in the ADBC classes.

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.

Use for general database accesses where possible.

Notes

  • When using Native SQL, the order of the columns in database tables defined in the ABAP Dictionary in the database system does not have to match the order of the structure definition in the ABAP Dictionary. When using , this is respected accordingly in the database interface and the order in the ABAP Dictionary can always be assumed. When using Native SQL, the order of the columns in the database system must be respected explicitly.
  • Special care must be taken when using Native SQL to pass data from ABAP to the database system and vice versa. 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 matching types in the type system of the database system used. Although types from the ABAP Dictionary can be mapped to ABAP types and the appropriate conversions can be executed from the interface when using , 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 implicit client handling. When accessing client-dependent 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.
  • Apart from their differences in syntax, Native SQL statements can behave in different ways on different platforms, particularly when compared with . This mainly affects the following:
  • Handling of blanks in strings

  • Calculation rules and roundings in arithmetic calculations

  • Overflow behavior

For more information about the exact behavior, see the documentation of the vendor-specific Native SQL.
  • Special care should be taken when using the Native SQL statements SET TRANSACTION to set the transaction behavior of the current database connection. The default behavior must be reset before the end of the current database LUW to avoid unwanted or critical behavior. When the SAP HANA database is accessed, special methods must be used that reset automatically instead of these Native SQL statements.
  • The examples shown for Native SQL generally work on SAP's own SAP HANA database. They might not work on other database platforms. The documentation about Native SQL in the SAP HANA database can be found under SAP HANA SQL and System Views References.





RFUMSV00 - Advance Return for Tax on Sales/Purchases   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 5745 Date: 20240420 Time: 090953     sap01-206 ( 81 ms )