Just after returning from SAP Teched held at Bangalore recently, with packed back to back sessions and demo pod areas on HANA (specifically in the area of ABAP for HANA), the learning has been awesome. It promises another exciting year ahead. We already have good blogs in this area, but I tried to put in my understanding about how SAP HANA can be leveraged to accelerate existing ABAP applications in ERP.
In this blog, I have tried to summarize different approaches that can be followed to make existing ABAP applications accelerate by leveraging the optimization techniques through SAP HANA.
- First do a Root cause analysis to check why the reports are running slow (do a Trace ST05). If the runtime takes place mostly on the database level then HANA could be beneficial to your performance without changing much in the code.
- If the majority of the runtime takes place on the application server (e.g. processing of internal tables) then you may need to think about rewriting the report if you want to make use of HANA. With HANA you can let the database do the heavy calculations, aggregations, etc. This can be done easily by using HANA as secondary database.
For both the above approaches, we could use a side-by-side car approach where in HANA is used as a secondary database, data is replicated from ERP to HANA through SAP LT replication server as shown below.
- If you have a more complicated application which you want to optimize for SAP HANA (or maybe you want to develop a completely new application based on ABAP/SAP HANA and you cannot wait for ERP on SAP HANA to be available or you don’t want to migrate your SAP ERP system to SAP HANA at all), then we could consider AS ABAP 7.4, which is optimized to leverage in-memory computing features of HANA. Sample scenario would look like this.
A beta shipment for this is planned for end 2012. Ramp-Up is planned for 2013. Lets try not to include features of AS ABAP 7.4 in this blog as the focus is here on current General Available HANA system(AS ABAP 7.x)
Some of the techniques that we could use to accelerate our existing ABAP applications are as follows.
- 1. Business Application accelerator: a SAP HANA database together with an instrumented application server. A well defined set of tables is replicated continuously to the SAP HANA database. The instrumented application server is able to run the ERP applications without modifications. It executes read and write operations on the main database. Only for certain scenarios it reads data from replicated tables on the SAP HANA database via a secondary database connection and not from the main database: Instrumented Application server is as shown below :
Scenarios are specified by defining the context in which data is to be read from the SAP HANA database.
Context Definition – This can be done at Tables / DB Views , or Main program or Batch job name level. This can be done by creating an entry in RDA_CONFIG table. This table can also be maintained by RDA_MAINTAIN report that uses a scenario (Scenarios are specified by defining the context in which data is to be read from the SAP HANA database. – this is in the form of an .xml file ) with a table name and program name, use the “Upload scenario” option. This is an easy mechanism to enable the application to read data from HANA database instead of the classical database.
Once an entry is created in the above table, the “Connection Decider” decides to read data either from secondary database (HANA database here) or from the Primary database as shown below.
Instrumented application server needs the following steps to be done
- SAP Business Application Accelerator Add On package needs to be installed (SAP Note 1713986 and 1716826) , Also complete details of this should be available in SAP note 1694697
- Upgrade SAP Kernel of AS to 7.2.1 (SAP Note 1713986 and 1716826)
- Activation of SAP Business Application Accelerator need to be done by enabling the profile parameter as rsdb/rda = on in transaction RZ11.
- Data needs to be replication from SAP Business suite system to HANA environment – SLT is the replication mechanism suggested by SAP here. Take care, that all tables / views that are part of the scenario are created on the SAP HANA database and start the replication for those tables.
- Setup Secondary Database Connection – Need to do the same in table for table DBCON, by providing the DBMS type (HDB for HANA), the user name and password you want to use for all connections and the connection string. This is explained in detail in Thomas Jung’s blog HANA Connectivity via Secondary database connection .
- Set secondary database connection for the scenario – Use report RDA_MAINTAIN to set the secondary database connection for the scenario. Select “Maintain Database Connection”, specify the scenario name, the name of the secondary database connection from previous step.
- Activate scenario by the RDA_MAINTAIN report.
2. ADBC (ABAP Database Connectivity) – ADBC is an API for the Native SQL interface of the AS ABAP that is based on ABAP Objects. With ADBC, we can do the following:
- Access to entire SQL functionality of underlying DB system
- Dynamic creation and execution of native SQL statements via respective API methods
- Clean concept for multiple DB connections (connections are associated to connection objects)
- Exception handling – API methods have well-defined exceptions that can be handled
- Native SQL can be used via EXEC SQL (and related) statements or the ABAP Objects based ADBC (ABAP Database Connectivity) API.
Class CL_SQL_CONNECTION offers methods like Create, update, insert etc to work with the underlying database. It is suggested to use ADBC as it works faster than the open SQL.
3. Code Pushdown – Calculation logic in applications can be pushed down from the Application server to the Database server. This can be done easily through SQL script (procedural extension of SQL). SQL script procedures may contain SQL statements and call other procedures. It is used to write procedural orchestration logic and to define complex data flows. . The SQL script procedure can be created easily as shown below:
Stored procedures can be created in SQL script editor of HANA studio or can be created in ABAP program. Same can be consumed through ADBC and has been proved that SAP script procedures works faster that simple open SQL statements.
Some of the blogs on SCN that can help to accelerate SAP ECC Applications.
What is the future of ABAPer ? Is there anything new coming up? has been one of the major questions lingering in most of the ABAPer’s minds , I could find that the answer indeed was Adapt to the changing SAP scenarios, improve your zest to learn new Technologies Learn the required skill sets for the same – ABAP for HANA, SQL scripts etc, experiment the learning and move on …