Skip to Content
Technical Articles
Author's profile photo Shakeel Ahmed

Code Review, Code Inspector, Code Pushdown & Key Changes in ABAP – S/4HANA

# Overview

This Article will help SAP Application Consultants who have passion for ABAP coding. It will cover followings:

  1. S/4HANA Conversion & Custom Code
  2. Changes in ABAP Dictionary Objects
  3. Essential ABAP Code Review
  4. Performance Booster ABAP Code Review
  5. Tools for ABAP Code Review

This article has been made with the help of SAP ABAP Training and Training Material. Thanks to SAP for this.

# S/4HANA Conversion & Custom Code

When a customer migrates an existing SAP system to S/4HANA, the standard ABAP code is migrated, and if necessary, adjusted automatically by the migration tools in order to run optimally on SAP HANA.

Although the migration tools move custom code to the new S/4HANA target system, there is no automatic adjustment of the code.

The good news is that, in most cases, the code will run as expected. However, an important task in a migration to an S/4HANA project should be the detailed review of custom ABAP code in order to ensure the following:

  • That the custom code still functions as expected – there are a few coding techniques and database objects that simply do not work in S/4HANA and must be replaced.
  • That the custom code runs optimally with SAP HANA. Although the code may run, there are easy adjustments to the code that can make a huge impact on performance.

# Changes in ABAP Dictionary Objects

In the past, special types of ABAP tables were used in order to overcome limitations of the underlying databases that powered SAP applications.

The tables shown in the figure are called pool and cluster tables and are found in standard and custom ABAP code. One of the key reasons for using special tables was to overcome design limitations of tables in certain databases. The special tables sit in the ABAP layer on top of the physical database and act as a logical layer to the ABAP code.

SAP S/4HANA does not need these special tables, and uses only one type of table, called a transparent table, with no loss in performance or function. A transparent table has a one-to-one relationship with a physical table.

During migration, the special tables are converted to transparent tables. SAP standard code is automatically adjusted to switch from calling the special tables to calling the transparent tables. Secondary indexes are dropped during migration. Indexes are usually not required by SAP HANA. If your code refers to them, you must make adjustments.

Customers and partners need to make their own checks and adjust their code where necessary.

However, if your custom code refers to a standard table that has now been removed, SAP provides views for all removed tables. This means your code still works and just uses the view.

# Essential ABAP Code Review

Issues to watch for with the ABAP code that mean the application may not function as expected are as follows:

  • Review of native SQL: For example, functions that only work with MS SQL Server, and database hints to override the SQL execution plan (for example, use this aggregate if it exists).
  • Avoid SELECT *: This is another way of asking for all columns in a record. SAP HANA’s column-based database works better when you ask for only columns you need.
  • Do not assume a sort sequence of the results: Sort sequences were usually implied by the primary key, and SAP HANA does not pre-sort the data. You must explicitly code this sort request, if needed.

# Performance Booster ABAP Code Review

 

Look out for the following items in your existing ABAP code in order to improve the performance:

  • Avoid SELECT *

SAP HANA’s column-based database works better when you ask for only columns you need, and avoid filling memory with unwanted columns.

  • Try to Send a WHERE Clause to the SAP HANA Database

Often, developers request all data (they do not use WHERE), and then they filter the data in the application code.

  • Push Down all Data-Intensive Functions to the SAP HANA Database

Examples include aggregation, filters, and sorts. You do this by calling native SAP HANA database functions.

 

# Tools for ABAP Code Review

SAP provides tools to speed up and automate the code review phase and ensure nothing is missed.

ABAP Code Inspector allows developers to choose the type of checks they want to make. For example, the following:

Code Checks

  • Show me where I refer to pool and cluster tables
  • Show me where I use SELECT *
  • SQL Monitor identifies bottlenecks, so developers can focus on improving the most problematic code. For example, it takes a long time to read a table: maybe table partitioning could help?

Usage and Procedure Logging (UPL) identifies dead code, or code that is rarely used. Do not waste time to improve this if nobody uses it.

 

 

—–END—–

Learn > Share > Grow

 

Stay connected for more such learnings and blogs.

Assigned Tags

      23 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Michelle Crapo
      Michelle Crapo

      Interesting - a lot of this is a part of good coding practice for lower versions of SAP.  Some of the "tables" going away, now that is a change. It will be a big part of revising our code.  Also we started with some analysis of if the code is really needed. Is there something that replaced it? It is a good time to take inventory and get rid of as many custom programs as possible. Another analysis is the business process can it be moved to a "SAP way of doing things". This is at some point when we move to HANA . Until then I'm reading blogs, getting free training - there was a migration class for data.  It didn't include the code.

      It looks like there will be a lot of manual changes. Of course the code inspector will help.

      Nice blog.  Including pictures! I have to like that.

      Michelle

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      Thanks Michelle. But I could not understand the question (Is there something that replaced it?

       

      Regards

      Shakeel

       

      Author's profile photo Michelle Crapo
      Michelle Crapo

      No there isn't something that replaced it.   No question, I was just leaving a comment. I wanted to add that there was a data migration tool.   There is a open course that covers the basics on how to use it.

      I think  Joachim makes my point better than I do. I think good coding practices would stop things like Select *. When I posed my question, is there something that replaced it? I meant did the new version of SAP offer something similar to the ABAP program.  If it does, then the program is no longer needed.

      Thank you for asking - I probably confused other people too!

      Michelle

      Author's profile photo Joachim Rees
      Joachim Rees

      Hi Shakeel,

      a nice, high-level overview for that target group (SAP Application Consultants) you mentioned.

      This one I would oppose to:

      Often, developers request all data (they do not use WHERE), and then they filter the data in the application code.

      I really hope developers don't do that! (I don't).

       

      Another point worth mentioning: The cleanup of custom code (including elimination of no longer needed code) can and should be done way up front of the actual conversion (the wording "migration" you use is not 100% correct here, as SAP ERP and SAP S/4HANA are different products).

       

      best
      Joachim

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      Hi Joachim,

      I am Functional Consultant-FICO and have limited knowledge about the ABAP. Please forgive if any inconsistency or mistake is there.

      Regards
      Shakeel

      Author's profile photo Joachim Rees
      Joachim Rees

      that's the nice part of community: you get feedback and additions by others and in the end, everyone benefits!

       

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      Yes, Joachim. I agree with you completely except few people.

       

      Author's profile photo Florian Henninger
      Florian Henninger

      Mhh... maybe I should check on that tomorrow 😉

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Yep, most of these things have already been best practice for some time. And custom code should be revised and improved constantly (ideally 🙂 ).

      There is a lot of information already available for the ABAPers regarding the changes in HANA or S/4HANA and how we can start preparing. I'd suggest for the functional consultants to focus on their area of expertise and let ABAPers do their job. 🙂

      As a very high level overview, it is OK. I liked a simple explanation of the pool/cluster table concept. I sometimes struggled to explain this in plain language to non-technical folks.

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      Dear Jelena,

      With all due rest I would like to call that ‘You are offending’.

      Who are you to suggest anyone who should do what.

      In future I would expect better and positive comments from you.

      Best Regards

      Shakeel

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      rest= respect

       

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      FYI: we can edit our comments, it's not Twitter.

       

      Author's profile photo Joachim Rees
      Joachim Rees

      In theory yes, but in practice you often can't edit, because of this "We are unable to complete your request. You may have been logged out from your session. Please re-login and try again."-bug! 🙁

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Yes, you're right. Almost forgot about that, sorry!

       

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      I'm confused... Which part exactly offends you?

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      Dear Jelena,

      Message is loud and clear. People would have understood about you and your thought process. I am done with you and don’t have any more time for you.

      Yes, you are really confused person and that you have accepted.

      PS: was editing on mobile and some error was there. So thought let post separate reply for correction.

       

      Regards

      Shakeel

       

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Uhm, OK... I still remain confused how exactly my comment offends anyone. Perhaps you didn't notice the smiley faces? Not sure if they're rendered well on a mobile device...

      Even though it clearly was meant as rather "tongue-in-cheek", in all seriousness I do believe that it's better for everyone to do their own job. Do you disagree with that? Then please share some arguments. You were asking who am I - well, I'm an ABAP developer who had to fix too many problems that were caused by the functional consultants writing ABAP in the situations where they did not have enough knowledge to do it right. Does that qualify me enough to have an opinion in the matter?

      By any means, I'm all for "cross-training" and believe it's beneficial both for ABAPers to know about functional aspects and for functional folks to know something about ABAP. But we all need to understand that learning a bit about something does not necessarily make us an expert.

      I'd like to highlight that my comment did not contain a personal attack on anyone. As a matter of fact, I did not even criticize your blog. It is just OK, neither bad nor especially great as far as SCN blogs go. This is my personal opinion, anyone is free to disagree. It's rather unrealistic IMHO to expect everyone to have an opinion only to your liking.

      At the same time, your responses do look very much like a personal attack on me and I feel it's  uncalled for.

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author
      1. Very Smart this time in writing. I appreciate that
      2. There are thousands of ABAPERs on the earth and all are smart, intelligent, knowledgeable and I love working with them.
      3. You words in the first comment "I’d suggest for the functional consultants to focus on their area of expertise and let ABAPers do their job" - Just don't get into it.
      4. No personal attack. But yeah it was a fit respons on comments.
      5. Live and let live please. Have great time ahead in life. Bye.

       

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      PS: response to this line (" It is just OK, neither bad nor especially great as far as SCN blogs go") about the blog. See below, it got selected for featured content on SAP community site. I hope you got  fit reply again.

      Author's profile photo Joachim Rees
      Joachim Rees

      I can't see it featured, maybe it was there only shortly or by mistake?

       

      (I did scroll to the right, too, it's not there either...)

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      It was there for a week my friend. Why would you make such comments with screen shot? I did not get the intention. It was not there for good.  😉

       

      Author's profile photo Nabheet Madan
      Nabheet Madan

      Dear Shakeel

       

      Thanks for writing the blog.  I am back to SCN after long and catching up on things. I too feel Jelena Perfiljeva was not rude at all. All that is written in the blog are valid practices and can be found at many places if we google.

      Please understand whenever any one provide feedback take it in a constructive way and when that feedback comes from Mentors then we shall it more seriously.

      I hope you will understand my point.

      Thanks

      Nabheet

      Author's profile photo Shakeel Ahmed
      Shakeel Ahmed
      Blog Post Author

      Nabheet please read this section “I’d suggest for the functional consultants to focus on their area of expertise and let ABAPers do their job”

       

      what tou say?

      my coment was for this section.