Ansicht
Dokumentation

ABENDATABASE_ACCESS_GUIDL - DATABASE ACCESS GUIDL

ABENDATABASE_ACCESS_GUIDL - DATABASE ACCESS GUIDL

rdisp/max_wprun_time - Maximum work process run time   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Database Accesses

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

Implemented by ABAP statements, is a subset of the Structured Query Language (SQL) comprising the DML (Data Manipulation Language) part. The statements use the interface for platform-independent access to those database tables in the standard AS ABAP database defined in ABAP Dictionary and having instances created in the ABAP database schema.
  • AMDP
The AMDP framework is used to manage and call ABAP Managed Database Procedures. These are database procedures or database procedures implemented as AMDP procedures in an AMDP method or an AMDP class and replicated to the database system from here.
  • Native SQL
Database-specific SQL statements that include both DML and DDL (Data Definition Language) statements and which can be passed to the Native SQL interface of the database as follows:
  • The methods of ADBC make it possible to execute dynamic SQL statements on a database system and process the results. ADBC (ABAP Database Connectivity), a class-based API that enables object-oriented access to the Native SQL interface.

  • Native SQL statements can be specified in ABAP programs between the statements EXEC SQL and ENDEXEC. Static Native SQL statements of this kind are not checked completely by the syntax check and are forwarded almost unchanged from the Native SQL interface to the database of an AS ABAP.

Alongside access to the ABAP database schema of the standard AS ABAP database, all access types (except for AMDP) also allow access to other databases and other database schemas using additional database connections.

Using

Use for general database accesses where possible. Only use AMDP and Native SQL for tasks where is not suitable.

Only is guaranteed to be independent of the database platform used. For this reason, 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 can be used in ABAP directly as structured types for the declaration of suitable work areas. Only supports table buffering of table content in the shared memory.

AMDP and Native SQL should only be used if the task really cannot be solved using . Services that work with AMDP and 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 accessed using the Native SQL interface instead of the interface, AMDP or ADBC should be used.

  • AMDP, currently only available for a SAP HANA database as the standard AS ABAP database, is recommended for all tasks that swap out code from ABAP programs to this SAP HANA database for performance reasons.
  • 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. Newer SQL statements, such as WITH for common table expressions (CTEs), are not supported in full by EXEC SQL.

Notes

  • The rule dictating that is to be used for as long as possible applies in particular to AMDP too. It is not a good idea to swap out SQL statements to database procedures if these could be implemented using or ABAP CDS too. In this case, no performance gains can be expected since the statements are updated to Native SQL by the database interface in exactly the same way as they would be written in the database procedure. Using AMDP is a good idea only if HANA-specific properties can be exploited by procedure calls or if repeated transports of large amounts of data between the database and the AS ABAP can be bypassed.
  • It is not advisable to access ABAP-managed database objects if the access does not take place in ABAP programs.

See the executable example AMDP, Comparison with. Database access not programmed well using can often be optimized by improved use of , making it unnecessary to use AMDP in these cases.

See the executable example Currency Conversion with SQLScript. In this case, a specific built-in function of HANA SQL is used that was not generally available in ABAP SQL. Meanwhile, the function currency_conversion is available in ABAP SQL and can replace the usage of AMDP.






TXBHW - Original Tax Base Amount in Local Currency   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 6687 Date: 20240425 Time: 131836     sap01-206 ( 118 ms )