Ansicht
Dokumentation

ABENFROM_ADBC_TO_AMDP_ABEXA - FROM ADBC TO AMDP ABEXA

ABENFROM_ADBC_TO_AMDP_ABEXA - FROM ADBC TO AMDP ABEXA

TXBHW - Original Tax Base Amount in Local Currency   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

SAP HANA, from ADBC to AMDP

This example demonstrates how a task can be performed using HANA-specific language elements.

Source Code

Execute

Description

The task is to read all rows from the database table SFLIGHT whose key fields MANDT, CARRID, and CONNID occur in a predefined three-column internal table. To do this, the example program calls various methods of the class CL_DEMO_FROM_ADBC_TO_AMDP in whose instance constructor the internal table connection_tab is filled in accordance with user input.

Note

The examples of using HANA-specific language elements shown in the methods are syntax-only examples. The task presented here can be solved just as well using , which is why is the preferred method as specified in the programming guidelines.

Reference Implementation Using

The method ASQL shows how the task can be solved in by simply using the addition FOR ALL ENTRIES. The result of the method is used as a reference for the HANA-specific implementations.

Using Native SQL with ADBC

The method ADBC solves the task by using HANA-specific Native SQL statements that are passed to the SAP HANA database using ADBC. The table with the key values is evaluated after the addition exists in a subquery of a select statement. To do this, a temporary table DEMO_ADBC_CONNECTIONS is created on the database and filled with the content of the connection_tab using the statement insert. To access the result of the select statement, a standard table std_flights must be declared as a local internal table of the method, since the return value flights cannot be used for ADBC. The temporary table DEMO_ADBC_CONNECTIONS is removed again after SPFLI is read.

Call of a Database Procedure Using a Database Procedure Proxy

The method CDBP solves the task by implementing the HANA-specific select statement in a database procedure that is called by specifying a database procedure proxy in the statement CALL DATABASE PROCEDURE. In a more realistic example, the database procedure DEMO_ADBC_GET_FLIGHTS and the database procedure proxy DEMO_ADBC_GET_FLIGHTS_PROXY would already exist and the implementation of the method would be restricted to the call CALL DATABASE PROCEDURE (see the executable example for procedure calls). In this example, the database procedure and the database procedure proxy are created temporarily and deleted again using ADBC methods and the associated API. The input parameter connections of the procedure references an additional temporary HANA table type, DEMO_ADBC_CONNECTIONS_TYPE. HANA does not support a separate type for numeric text, which means that the type NVARCHAR(4) must be used for the column CONNID. Therefore, the internal table connection_tab must be assigned to a temporary table connections with the correct row type before the procedure is called. No auxiliary table is required for the result, since the row type is described using an ABAP Dictionary type. An appropriate mapping can be performed for this type using the mapping table params. As an alternative to an auxiliary table for connection_tab, its data type could also be declared in the ABAP Dictionary and an appropriate mapping performed.

The statement CALL DATABASE PROCEDURE is not possible on a SAP HANA Cloud database.

Call an AMDP Procedure

The method AMDP solves the task in the easiest possible way by calling an AMDP method AMDP_METH in which the HANA-specific select statement is implemented in an AMDP procedure. The main advantage of the AMDP method is that it can be called in the same way as any ABAP method and no auxiliary tables must be introduced, as was the case in the preceding examples.






RFUMSV00 - Advance Return for Tax on Sales/Purchases   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 5855 Date: 20240418 Time: 134817     sap01-206 ( 50 ms )