14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Top-Down Development 15.2

Summary

In this section, you’ve created a DDL objectin Eclipse, in which you wrote a much more

complicated SQL statement than would be possible in ABAP. When the DDL object

activated, an SE11 view was created on the ABAP system, and a CDS view was created

in the SAP HANA database.

Before the CDS view concept came along, you had to retrieve the data from the database

using a view and then do some manipulation of that data in your ABAP program.

Now, because the CDS view (which runs in the database) has taken over some of the

tasks that formerly you would have done in the ABAP program (which runs on an application

server), those tasks—or, more accurately, the code to do those tasks—has been

pushed down into the database.

15.2.2 Building and Calling ABAP Managed Database Procedures

In Section 15.3, you’ll see that, in the bottom-up development approach, the call

to a stored procedure is a bit like usin g a function module—that is, very procedural

(old-fashioned). With the top-do wn approach, you have instead an ABAP

Managed Database Procedure (AMDP), which is a method of a class and thus fully

object oriented.

As you know, when you create classes and methods of a cl ass, there are two

things you need to code: the definition and the implementation. The process for

an AMDP is exactly the same. First, you’ll look at how to define a class such that

one or more of its methods can be execut ed directly on the database by means

of an SAP HANA stored procedure. Then , you’ll learn how to code the implementation

of such a method using SQLScript, such that although the code is

written in the ABAP system it will actual ly execute inside the SAP HANA database

at runtime.

Defining the ABAP Method

If you have a class that has at least one method in which you would like to delegate

processing to the database, then th e only change you need to make to the

definition of that class is to include the interface IF_AMDP_MARKER_HDB, as shown

in Listing 15.11.

CLASS zcl_monsters DEFINITION.

PUBLIC SECTION.

INTERFACES IF_AMDP_MARKER_HDB.

671

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!