Where ABAP meets SAP HANA

ABAP HANA Image

All SAP products are moving to SAP HANA, the most talked about SAP innovation in recent times. This evolution intensifies the demands on SAP NetWeaver Application Server ABAP (AS ABAP) to best leverage the features and capabilities of the SAP HANA database. As an ABAP developer you might ask, what is important and necessary to know concerning ABAP development for SAP HANA?

This blog is aimed at answering this and other related questions.

It is always better to begin with FAQ’s about ABAP for SAP HANA by SAP.

ABAP HANA FAQ

Here’s a short Intro on ABAP HANA from SAP

ABAP HANA Features

This blog explores in detail the major ABAP development features that take advantage of SAP HANA — in particular, it looks at new features for database-independent programming with Open SQL, unified data modelling and definition with core data services, and simplified control of stored procedures with ABAP-managed database procedures.

All the features discussed can be easily explored using the Eclipse-based ABAP development tools for SAP NetWeaver (known as ABAP in Eclipse), which provide many productivity features that can help developers in their daily development work

Database dependent programming with open SQL

The new syntax for Open SQL, which includes support for comma separated lists, enhanced string expressions, the definition of host variables in a more standard fashion, and fewer restrictions for joins.

Examples
The above new open SQL enhancement shows the comma separated fields and inline declaration instead of the explicit internal table declarations.

Specifying host variables without the escape character @ is obsolete. The escape character @ must be specified in the strict modes of the syntax check from Release 7.40, SP05. 
Please read the below PDF document to get to know more about the New open SQL Enhancements.

Open sql

 

Unified Data Modeling and Definition with Core Data Services

In the past, data modeling in ABAP usually involved defining and managing views of your data on the ABAP server, using tools such as the ABAP dictionary in the ABAP Workbench. In keeping with the paradigm shift of moving data operations to the database — to take advantage of in-memory processing, for instance — SAP introduced core data services (CDS) with SPS 05 for SAP NetWeaver 7.4.

CDS is a data modeling infrastructure for defining and consuming semantic and reusable data models on the database, rather than on the ABAP server, regardless of the database system used. CDS offers a SQL-oriented abstraction layer that extends the SQL-92 standard with features that bridge and unify the traditional OLTP and OLAP models of data definition, data query, and data manipulation. Supported natively in both ABAP and SAP HANA, the data models are expressed in data definition language (DDL) and are defined as CDS views, which can be used in ABAP programs via Open SQL statements to enable access to the database.

Code data service has a layer between application layer and database, and its independent of database technology.

Defining CDS Views

Definition only possible with ABAP development tools in eclipse not via transaction SE11.

CDS Definition

CDS Definition

Consuming CDS View in Program

Since CDS views provide an abstraction layer that is optimally suited for in-memory SAP HANA execution, but portable to other database platforms, you can easily consume the CDS views from within new and existing ABAP programs.

 

Please watthe below video to get to know more about the New open SQL Enhancements.

 

ABAP Managed Database Procedures

AMDPs allow developers to create and manage stored procedures directly in ABAP, while they are executed on the database level. The ability to create AMDPs with proper embedding in the ABAP execution context means that they are fully managed by the SAP system’s change and transport system, and behave like any other ABAP artifact from a lifecycle management perspective. The development work takes place completely in ABAP in Eclipse; there is no need to drill down into the SAP HANA studio to define AMDPs.

Keep in mind that although AMDPs are defined on the ABAP level, they are by nature dependent on the underlying database platform, so that they can fully optimize the database in use. For this reason, the implementation language will vary depending on the database in use. For SAP HANA, the implementation language is SQLScript, so creating an AMDP for SAP HANA is as simple as implementing SQLScript in your ABAP program, both in new and existing programs.

Notes:

  • The parameters must be declared using VALUE for pass by value. Pass by reference is not permitted.
  • Return values cannot be declared using RETURNING.
  • To create an AMDP you need to use at least ABAP Development Tools in Eclipse,open an AMDP with se80 /se24, but you won’t be able to edit it.

Creating AMDP

 AMDPs are wrapped into regular global ABAP classes. A method that contains a stored procedure is introduced by the special keyword by database procedure for hdb language sqlscript, which indicates that other database platforms can hook in their particular programming languages for stored procedure development.

METHOD XXX BY DATABASE PROCEDURE FOR <DB Name> LANGUAGE sqlscript

                             USING <Table>.

ENDMETHOD.

 

Summary

Open SQL, core data services, and ABAP-managed database procedures provide powerful abstractions that enable ABAP developers to combine the benefits of the high-speed in-memory execution of SAP HANA with the well-established ABAP runtime and lifecycle model. The various tools included with ABAP in Eclipse help you to quickly prototype and test these artifacts with short turnaround cycles. This approach empowers ABAP developers to renovate their existing assets and create new and innovative applications for SAP Business Suite on SAP HANA without losing the platform-independence of ABAP development. SPS 05 provides a solid starting point, with many additions and enhancements delivered by SPS 08 and follow-up functional support packages.

 

Featured  image from sapyard.com

 

 

 


About Karthik

Developer - SAP Technical ABAP. Area of interest in SAP ABAP HANA, IoT, SAP Netweaver Gateway serivce, UI5/Fiori.