SQL Script for ABAP Managed Database Procedures

0

SQL for ABAP Managed Database: In a traditional ABAP application development approach, the database is used only as a static repository for data, from the data to the code to the left of the following figure. ABAP application developers use open SQL and other methods to read data from the database layer to the ABAP application layer and apply it to the ABAP tier for data processing.

Code pushing means changing programming concepts, i.e., pushing intensive data calculations from the ABAP application layer to the HANA database layer, as shown on the right side of the figure above, and making the most of the high-performance data processing capabilities of hana databases.

To implement code pushdown, the SAP HANA database must provide technology that allows ABAP developers to write application logic directly at the HANA database layer. These application logics can be implemented in so-called database programs, which are implementation languages for SAP HANA SQLScript.

You can compare database procedures with the capabilities that can only read and write databases and perform related operations, receive any number of input parameters, define output parameters, and store the results of database operations. Parameter types can be integer, double, vulture, or expressive.

The ABAP development tool allows you to choose two different ways to implement database processes. The first is AMDP, which is listed in the title of this article, and the second is the database program agent.

AMDP, as the name implies, implements HANA database processes and lifecycle management at the ABAP layer. Developers use the ABAP development tools at the ABAP tier to create HANA SQLScript as an AMDP implementation, consuming the local functionality of the HANA database layer directly in the ABAP tier.

In the implementation process, what types of development objects describe Hana SQLScript in the ABAP layer? The answer remains in the ABAP class, but is only used in methods that declare a specific interface for the ABAP class and modify it using the AMDP-specific ABAP keyword. If you continue to develop AMDP using the ABAP class method, traditional ABAP application developers will not have to pay additional learning costs unless they are familiar with hana SQLScript syntax. This particular ABAP approach allows AMDP to adopt unified ABAP transport management, lifecycle management, code defect correction, and upgrade management methods as a container for HANA SQLScript, just like any other common ABAP development object.

In addition to AMDP, the database procedure agent is another way to implement the HANA database process. This method first creates a HANA native database process in the HANA repository, then a proxy pointing to the former in the ABAP layer, and then uses the proxy object in the ABAP application to consume the native database process in the HANA repository. This approach requires local development of the HANA layer compared to AMDP, so AMDP is recommended for real-world development scenarios.

As discussed in the previous overview section, AMDP is implemented in a special ABAP class. The professionalism of this ABAP class is that it is necessary to declare a tag interface (tag interface, some documents, also known as IF_AMDP_MARKER_HDB).

ABAP uses a tag interface approach because it does not have the capability to define metadata directly from the language level, such as Java.

Annotations are almost everywhere in Java-based spring framework development. Annotations introduced in JDK1.5 and later can be declared in Java packages, classes, fields, methods, local variables, method parameters, and other resources to provide flexibility and convenience in maintaining metadata. However, before JDK 1.5, the label interface was also the only way for Java to retain metadata at the language level.

The following figure shows the tag interface used by Java to define a class that supports serialization operations that correspond to the ALAP IF_SERIALIZABLE_OBJECT.

This method get_flights another method that reads data from the database table convert_currency, converts the currency directly at the HANA database level, and returns the result to the output parameter result of the ALAP layer.

As mentioned earlier, AMDP is implemented in a special way for special ALAP classes. The special ALAP class described above IF_AMDP_MARKER_HDB a special interface. Compared to regular ALAP methods, the peculiarities of AMDP methods are reflected in these ATAP keywords in BY database programs in the HDB language SQLSCRIPT.

The ABAP keyword in the red area in the image above indicates that the modified ALAP method is an AMDP container. Amdp’s implementation language is HANA SQLScript, which provides read-only access to two database tables, dmo/flight, and /dmo/carrier. Another AMDP is called convert_currency currency conversion.

The logic of this AMDP is primarily to receive data from the internal connections of /dmo/flight and /dmo/carrier tables as input and to convert the price of tickets in the database to euro values using hana SQLScript’s built-in features convert_currency.

Click “Read original text” below to get the full source code for this sample and log in to the ABAP local system using the ABAP development tool (database is HANA, ALAP version is 7.40 SP05) This must be the case), you can migrate to the cloud using Jerry’s previous article ALAP development, use the trial version of the SAP cloud platform ABAP environment for free, and apply the free SAP cloud platform ABAP programming environment to try AMDP development.

Click “Read original text” below to get the full source code for this sample and log in to the ABAP local system using the ABAP development tool (database is HANA, ABAP version is 7.40 SP05) This must be the case), you can migrate to the cloud using Jerry’s previous article ALAP development, use the trial version of the SAP cloud platform ABAP environment for free, and apply the free SAP cloud platform ABAP programming environment to try AMDP development.

This tag interface functions as an annotation in modern Java development, metadata dictates ABAP compilation and execution times, and this ABAP class functions as a container for storing AMDP implementations.

In addition to IF_AMDP_MARKER_HDB, ABAP has many other features, such as the ABAP class representing an interface that supports IF_SERIALIZABLE_OBJECT.

Mark the interfaces that need to be defined using BAdI IF_BADI_INTERFACE. When you create or modify a new BAdI for ABAP, the interface defined in the BAdI definition (IF_BADI_INTERFACE do not use the declaration interface) does not pass the ABAP syntax check.

Leave A Reply

Your email address will not be published.