An approach that S/4HANA means for many people is like the ECC with a renewed “super-body“. Then, We can now quote the Bernoulli’s epitaph: “Eadem mutata resurgo” (Although changed, I rise again the same).
The Migration/Conversion to S/4HANA is a very interesting topic to ABAP for HANA Developers and this article is a general presentation of some of the ABAP fundamentals and tools that are available. In this sense, it can be useful for those ABAP Developers who need an introduction to the new resources available within HANA and some basic examples.
The knowledge that I may have acquired to write this blog comes mainly from reading and studying the handbook “HA400” from the SAP Learning Hub and also of my own experience. In this process and without any more preambles I allow myself to present a question and also I could give an answer to it:
All ABAP custom code goes faster?
In fact, some custom code can go faster, but others go slower. The code that respects the classic principles of good practices will go faster (plus a change of priorities). The code that not consider these good practices eventually goes as slow as before. In this sense, the Bernoulli’s epitaph may gain some relevance because something from the past must be preserved.
In general, “FOR ALL ENTRIES” sentences are automatically improved within S/4HANA. However, the rules of use remain (table pivot sorted and not empty). For example:
IF lit_but000 IS NOT INITIAL. SORT lit_but000 BY partner ASCENDING. SELECT partner, name_first INTO TABLE @DATA(lt_but000) FROM but000 FOR ALL ENTRIES IN @lit_but000 WHERE partner = @git_but000-partner . ENDIF.
The most important rules that stay valid and represents a change of priorities within classical principles of good practices are:
- Bring only the necessary fields from the database tables: Whenever possible use the field’s list instead asterisk (*) with the SELECT statement.
- Avoid making redundant access to the database: For example, avoid the use of nested SELECT within LOOPS.
Another less important rule is keeping the result set small, for example using “WHERE” clause as much as possible. Although less important, it also is important, because an array fetch of unnecessary records can be expensive to the SAP Buffer.
Code Inspector (Transaction SCI) can be used to get the performance issues in the code within the Migration to S/4HANA. You must fill a Name for the Inspection. For example:
By clicking on the button “Create“:
Marking a Single “Object Selection“, filling up the name of the Program and using the object variant “PERFORMANCE_DB“ you could get the next message:
By clicking on the green check you could get the message:
By clicking on the “Results” button:
You could get the list of Errors, Warnings and Informations about Performance Issues.
It’s possible to expand each of these items to see the detail of the issue:
By double click, also go directly to the line of code:
It’s possible to use other classic tools like:
- ATC transaction: to use with the same variant (PERFORMANCE_DB) in a more holistic way that SCI.
- ST05 transaction: trace programs to find Database Access with execution time.
- SAT transaction: a set of trace elements as Hit List, DB tables, Profiling and Times.
A new ABAP Profiling Perspective in Eclipse is available and this tool is similar to SAT transaction, but enriches with other elements like for example Call Diagrams.
The figure below summarizes a flow diagram of Custom ABAP Code Migration Scenarios:
Which other new tools are available with S/4HANA?
To improve performance, reuse data objects and to allow the possibility of modeling, other development’s objects appear in the ABAP’s radar:
- CDS Views
- Calculation Views
- Stored Procedures
- External Views
- Database Procedures Proxies
These new objects would conform to a new and very important golden rule:
- Code to Data: this means, work intensely in the database (or close to the database) like a “Push Down Capability”, doing extractions, aggregations, calculations and many other operations directly on the database server.
The new tools in Eclipse to build these objects are the ABAP Development Tools (ADT) and the Hana Studio. ADT is a tool that contains two types of experiences. The first is like SAP Classic GUI that is good to work with the Screen Painter and the second named “Look and Feel” is a new tool with its own characteristics as code templates to Object-Oriented Programming, Code Completion, and Quick Fix possibilities. The figure below summarizes the integration provided by Eclipse:
Hana Studio lets to build/edit Calculation Views and Stored Procedures and Eclipse is also an environment that lets to work with other programming languages as for example JAVA and SAP UI5. Right now there are also tools in the SAP Cloud Platform that contain some of the capacities of ADT and Hana Studio.
On the other hand, the ABAP Open SQL is now enriched with new sentences and it offers the possibility of use until 50 join’s tables and 50 subqueries.
The use of the new Hana Database as the primary element implies that Secondary Indexes are not relevant and aggregations are dropped. Also, many tables that previously were Table Pools and Clusters, are transparent now. The following figure summarizes this discussion:
In conclusion, within a Migration of custom ABAP code to S/4HANA, the performance in all cases is not faster immediately. The main classic ABAP rules that remain valid are:
- Minimize the amount of transferred data.
- Minimize the number of database accesses
- Keep the result set small
The less important rules are:
- Minimize search overhead
- Keep unnecessary load away from the DB
Instead of these less important rules, a new principle is established: Code to Data, which means work hard in the Database and transfer the results to ABAP Server.
New tools are available to ABAP Development, for example ABAP Development Tools (ADT) and HANA Studio. These tools let to build and edit new repository objects and do performance tests with new elements of analysis.
Thus, S/4HANA as the newest SAP’s platform without precedents in performance and innovations, like any other change in any other human’s topic, could susceptible to a great debate to others blogs. Quoting to Heraclitus that said “The Only Thing That Is Constant Is Change” You may think that although S/4HANA is the latest technology, obviously it will not be the last.
By the way, in February 2020, SAP announced that support to S/4HANA will go until 2040. Then, maybe in the “SAP’s Kitchen” a new platform itself could be cooking right now or at least the ingredients are getting ready. But, it remains only as speculation of the author. The time will judge and every day brings its own concern.
I hope that this article helps other people to build some knowledge of ABAP Migration to S/4HANA and open the mind to other questions. All comments and suggestions are welcome.