Skip to Content
Author's profile photo Horst Keller

ABAP News for Release 7.40 – ABAP and SAP HANA

ABAP and HANA! Finally! Now it comes! … So you might think.

But beware, I am only the ABAP language documentation writer. What I will say in this blog cannot be more than the ABAP language documentation writer’s worm’s-eye view. All the big and great facts about SAP HANA are explained somewhere else and are easy to find. Read on here only if you want to know what I know (or at least believe to know) about ABAP and SAP HANA …

AS ABAP and SAP HANA

First of all, SAP HANA is an appliance that is rather independent from ABAP.  It is a combined hardware and software system for SAP in-memory computing used for high-performance analysis of large volumes of data. You don’t need ABAP to work with SAP HANA. SAP HANA can be used standalone, meaning that you don’t need an (ABAP) application server any more. This would be the end of the classical three-tier-architecture. All applications would be written in SAP HANA (with the programming languages available there) and the interfaces of SAP HANA would be used to communicate with UIs or other systems based on common protocols.

But there might be reasons to keep a three-tier-architecture and with it an (ABAP) application server even with SAP HANA. One reason I can think of is all that administrative stuff (authorizations, transaction handling, transport management, etc.) that is already available in an (ABAP) application server. Even if you don’t run applications on an application server, you might reuse its administrative capabilities also for SAP HANA. Another reason are the applications itself of course. Is it conceivable that all the million lines of existing application coding are fully migrated to SAP HANA in the near future? I don’t think so. Instead, there probably will be a coexistance of ABAP application servers and SAP HANA, where the ABAP systems will use the analytic capabilities of SAP HANA wherever it is useful.

There are mainly two scenarios for such a coexistence:

  • Access of a standalone SAP HANA from AS ABAP
  • Using SAP HANA as the Database of an AS ABAP

Access of a standalone SAP HANA from AS ABAP

An AS ABAP can access a standalone SAP HANA appliance via its APIs and the in-memory database of such a standalone SAP HANA appliance using a secondary database connection and Native SQL (mostly ADBC). Various tools and accelerators are available for replicating data from the database of an AS ABAP to the SAP HANA database, to enable dedicated high-performance analyses. Those are not embedded in ABAP and described elsewhere.

Using SAP HANA as the Database of an AS ABAP

SAP HANA works with the SAP HANA database, which is based on in-memory technology. The good thing is, that the SAP HANA database (besides all its other capabilities) can behave like a relational SQL database. All one has to do is to extend the Database Interface (DBI) of the AS ABAP in such a way that it supports the SAP HANA database. And this was done for Release 7.40! With Release 7.40 an SAP HANA database can be used as the central database of an AS ABAP. As for each database system supported by the DBI, you can access the database tables that are managed in the ABAP Dictionary with Open SQL.

Using Open SQL on the SAP HANA Database

Running an AS ABAP functionally correct on an SAP HANA Database is one big step. But of course you want more. You want to gain performance. But this is not gained automatically. Although the database access is optimized to the greatest extent possible in the DBI, many existing ABAP programs do not perform better automatically (in unfortunate cases, performance might even be somewhat worse). Why? The reason is that many ABAP programs are not optimized for database performance at all! A SELECT SINGLE inside a loop is a bad thing for any database. How should HANA improve here?  And – be honest! – are you already using Joins extensively?

Currently there is an extensive investigation ongoing at SAP that determines how you can get the most out of your existing ABAP when running it on HANA. The result will be guidelines and accompanying check tools that will point out the positions in existing ABAP code, where performance gains can be achieved. Interestingly enough, the guidelines for HANA will not differ too much from the existing guidelines for Open SQL! If you cared about performance already in your programs up to now, you must not do much when switching to HANA (Deja vu! It mainly were the lousy written programs that had problems when switching from non-Unicode to Unicode).

More than Open SQL for the SAP HANA Database

If you really want to exploit the capabilities of HANA for extensive analytics you must do more than simply using Open SQL on existing database tables. The buzz word is “code pushdown”. Suitable parts of application logic can be transferred  from the application server to SAP HANA. In fact, already an Open SQL join can present such a pushdown and can have quite an effect. But there is more. Currently (7.40, SP02) ABAP offers two ways to access the analytic capabilities of an underlying HANA Database directly:

  • One way of doing analytics on HANA are the HANA views (attribute views, analytic views, and calculation views) that you model in the SAP HANA Studio and that internally are represented in SQL or in SQLScript (the language of HANA’s database procedures). These views are managed by SAP HANA and are not visible to Open SQL automatically. With Release 7.40, you can create so called external views for existing HANA views in ADT (ABAP Development Tools, Eclipse based). Such an external view is an ABAP Dictionary object (visible in SE11) and can be accessed by Open SQL like a normal dictionary view! The mapping between HANA types and ABAP types is done automatically. With other words: You can model parts or all of your analytics as a HANA view and access the result via an external view directly from ABAP now.
  • If you need a more complex analysis than a HANA view can offer, you have to program it with SQLScript in HANA database procedures. Before Release 7.40, the only way of calling such a procedure from ABAP was Native SQL (mainly ADBC), which meant a lot of (awkward) coding. With Release 7.40, there is a new statement CALL DATABASE PROCEDURE that you can use to call a HANA database procedure of the underlying SAP HANA Database directly. Similar to an external view, you can create a so called Database Procedure Proxy in the ABAP Dictionary (in ADT or via an API), that can be accessed directly in the new statement. The parameters of the HANA database procedure are mapped to ABAP parameters of the proxy and a call looks very ABAP-like as follows:

    CALL DATABASE PROCEDURE dbproc_proxy EXPORTING in  = in

                                         IMPORTING out = out.

        Believe me, doing the same with ADBC does not look so nice …

Outlook

While the above two ways of accessing HANA views and procedures are quite nice already, with Release 7.40, SP05  something really cool is going to come:

ABAP Managed  Database Procedures (AMDP)

You will be able to code SQLScript directly in an ABAP method! The method is declared and called normally as any other method of ABAP Objects. When implementing the method you will simply add the addition BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT to the METHOD statement. That’s all! The implementation of the method is then done fully in SQLScript. You work normally in the ABAP environment (including syntax checks, transport management, …) and the code is automatically pushed down to HANA by the ABAP runtime environment before you call the method. When the method is called, the database procedure is executed on the SAP HANA Database while for the caller the method has the same look and feel as any ABAP method.

In my humble opinion, this will be the way for ABAPers to work with an underlying HANA database …

PS: Another kind of code pushdown will become available by using expressions (calculations with columns, etc.) in the select list of Open SQL.

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      Comes right in time for tomorrows CodeJam Bielefeld "Abap on Hana". Danke

      Author's profile photo Oliver Russinger
      Oliver Russinger

      another great blog! adt comes more important over se80 in interpreting this blog?

      Author's profile photo Horst Keller
      Horst Keller
      Blog Post Author

      Seems that you read carefully 😉 .

      Yes, there is a clear tendency towards ADT. New ABAP tools for new technologies are offered in ADT only. The idea is that you can stay within one IDE. Say from SAP HANA Studio over ABAP Development Tools to UI5 tool everything should be possible in Eclipse.

      Author's profile photo Former Member
      Former Member

      Hello Horst,

      Being an ABAPer i was more interested in how do i adapt myself to HANA (worm-eye view, maybe 🙁 ). Your blog does answer my question to some extent, so thanks for sharing 🙂

      Moreover it looks like i have to "unlearn" the development techniques i have used till now viz., ABAP Workbench & learn the newer ones - ADT, AoE etc.

      BR,

      Suhas

      Author's profile photo Peter Inotai
      Peter Inotai

      Great summary.

      Do you have some screenshots about these new DDIC objects in SE11 (External views & Database Procedure Proxy)? I'd love to see them how they look like, since currently I have no access to a 7.40 system 🙁

      Thanks,

      Peter

      Author's profile photo Horst Keller
      Horst Keller
      Blog Post Author

      A few in http://www.gib-dispo-cockpit.de/mediathek/events/success-days-2013/DE/SDS_2013_ABAP_News_Dr_Keller_SAP.pdf .

      I didn't post that but why not (success is a process ...) 🙂

      Author's profile photo Peter Inotai
      Peter Inotai

      Thanks a lot. This whole presentation is really cool. Nice details about the 7.40 features.

      Peter

      Author's profile photo Peter Inotai
      Peter Inotai

      This class cl_demo_output seems to be a quite useful class. Is there some documentation available about it?

      It seems it's already available in 7.31.

      Thanks,

      Peter

      Author's profile photo Horst Keller
      Horst Keller
      Blog Post Author

      Teehee!

      CL_DEMO_OUTPUT (and its little sister CL_DEMO_INPUT) are my classes for my purposes and (of course) not intended for public usage in productive programs 😆 . It is documented in the class builder and availabe in 7.31, but the final version is 7.40 (still finding bugs when working with it, most difficult thing to do is to find out the names of data objects passed to the class). Example code for usage in package SABAP_DEMOS_OUTPUT_STREAM.

      I'm writing a new ABAP Language book (better I want to write to, if I find the time) and we asked ourself how to output (and input) data if we don't want to promote WRITE (and PARAMETERS) any more. The result was to create an XML-based demo output stream that converts arbitrary ABAP data (up to now I still reject nested structures, nested tables and references), texts, XML, JSON into an XML format (some ideas stolen from ODATA). The corresponding class CL_DEMO_OUTPUT_STREAM is encapsulated in CL_DEMO_OUTPUT, where the XML-data are converted to HTML or simple text. CL_DEMO_OUTPUT can be used via static and via instance methods. It will be the backbone of all outputs of the new book and it will be delivered to the readers in form of an include program (representing a demo framework for examples that are written  in ABAP Objects down to 7.02. No more START-OF-SELECTION!). In fact, I was also able to replace lots of WRITEs with the new output in the examples of the ABAP Keyword Documentation for 7.40. And this even allowed me to make those examples executable by mouse click in Eclipse! WRITE does not work that nicely in Eclipse, but an HTML format does.

      But all in all it can only be a demo of what could be possible, if one really wants to. A fully fledged output framework for productive usage is totally out of scope (remember, my job is to write documentation ...). Funnily enough, I also created the well known CL_ABAP_BROWSER only  for my own purposes some years ago (maybe I should have used a less verbose name 😈 ).

      Author's profile photo Peter Inotai
      Peter Inotai

      Thanks for the detailed answer!

      "not intended for public usage in productive programs"

      Anyway, it can be perfectly used during development to check the temporarily result and things like this.

      "I'm writing a new ABAP Language book"

      Very good news 🙂

      Author's profile photo Abdul Hakim
      Abdul Hakim

      Horst,

      Thanks for the excellent blog. I have few questions for you.

      You have mentioned that HANA is a appliance that does not require ABAP Server and applications can be completely built there without the need for ABAP server anymore. Whether this is the end of ABAP era in SAP? Whether SAP will slowly migrate all their products( ERP / CRM / SRM etc ) into HANA appliance and making the ABAP version of all these products obsolete in the future?? How does the future looks for ABAP consultant who are really passionate about ABAP and learning the new feature of it.. Appreciate if you can clarify my questions.

      Thanks

      Abdul Hakim

      Author's profile photo Horst Keller
      Horst Keller
      Blog Post Author

      Hi Abdul,

      As stated above, thiis blog expresses my personal view. Regarding your question I expressed it as follows:

      Is it conceivable that all the million lines of existing application coding are fully migrated to SAP HANA in the near future? I don't think so. Instead, there probably will be a coexistance of ABAP application servers and SAP HANA, where the ABAP systems will use the analytic capabilities of SAP HANA wherever it is useful.

      Currently, the ABAP language group is working hard in trimming good old ABAP to become a language that will work perfectly together with HANA. Besides the above mentioned features we will have Open SQL Expressions, advanced View Building in ABAP Dictionary, support of associations between tables and more.

      Of course, SAP will also deliver the technology to develop on HANA alone.It will be the architects and developers at SAP and on customer side who will decide what to use for which purpose.

      Best,

      Horst

      Author's profile photo Abdul Hakim
      Abdul Hakim

      Horst,

      Thanks for clarifying some of my questions 🙂

      I personally believe that ABAP will live long because it runs the business of thousands of customers all over the world and SAP is committed to bring new features to ABAP and make it more relevant for today's business need. ABAP 7.40 is the best example which is optimized for HANA. HANA cannot replace AS ABAP for sure. I can bet on it 😆

      Thanks

      Abdul Hakim

      Author's profile photo Murugesh Arcot
      Murugesh Arcot

      Hi Horst, Thanks for the detailed explanation. If you could depict the same (HANA push down) on a code sample it would help understand better. Especially the database procedure part.

      Best Regards, Murugesh

      Author's profile photo Horst Keller
      Horst Keller
      Blog Post Author

      Hi Murugesh,

      see ABAP Language News for Release 7.40, SP05.

      Best Horst

      (better late than never)

      Author's profile photo B@lu .
      B@lu .

      hi horst,

      can you please share tools provided by SAP, to find bad code areas of existing ABAP programs.