14.01.2020 Views

ABAP_to_the_Future

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Introduction to Code Pushdown 15.1

15.1 Introduction to Code Pushdown

One strange thing in life is that often you get told for years on end “This is the

way to do (whatever it is), this is the only way, and nothing else will work—so do

it this way,” and just when you’re comf ortable with this, everything changes

overnight and the very same experts start telling you to do the same thing in a different

way.

When it comes to SAP HANA, the change is as follows: For years, computer programming

textbooks have gone to great lengths to convince everyone to separate

the code that does database access and the code that does the business logic. You

have all done this, usually by having a separate class for the database accesses.

Now, with SAP HANA, because of the gigantic performance benefits, you’re

being encouraged to look for situations in which you can push down (or you

could say “outsource”) large chunks of business logic to the database layer.

In the ABAP world, you’ve been used to doing everything in the application layer.

There are two ways to move some of this logic to the database layer: stored procedures

and views. In the case of stored procedures, you write some code that is

going to be executed directly in the data base layer; this is called a stored procedure.

This could be just a SQL statement to select some data (though that would

be a bit pointless), but it’s usually one or more database queries sprinkled with

some business logic on top. The idea, as always, is to reduce the amount of data

transferred between the database and the application server—something you

always strive for, because this is one of the golden rules. In the case of the views,

you create a view, a concept that should not be that alien to ABAP programmers.

ABAP vs. SAP HANA Database Views

You know what a database view is in the ABAP world: You define a view in SE11 in

which you nominate one or more database ta bles, declare all the fields you are interested

in, the join conditions where approp riate, and maybe some selection conditions

(e.g., a view on VBAK in which you are only interested in quotations). A database view

in SAP HANA is pretty much exactly the same, except that the options you have within

SAP HANA are far greater.

In case you’re already getting nervous ab out delegating some ABAP tasks to the

database, you should realize that, most li kely, you are already doing just that to

some extent. For example, if you want to know how many purple monsters with

657

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

Saved successfully!

Ooh no, something went wrong!