Skip to Content

A couple of weeks ago I posted a question in the ABAP Testing and Troubleshooting forum about using transaction SAT for testing class performance. I wanted to test the runtime of class methods without using a transaction, program, or function module. The answers to my question were clear:

  • “No, it is not possible without creating a transaction, program or function module.”
  • “Without an instance of the class, it does not make sense to have an option in SAT for executing instance classes.”
  • “Why would you like to do that?”
  • “Do it by calling SE24 or SE80.”

Let me start by describing why I want to do this in the first place. My idea is that all developers should create performance reports for their class methods. Whenever a method is changed or enhanced by someone a new performance report is created and it is possible to review the performance and memory impact of the update. This should be done in a simple manner so that it does not require too much effort. Writing a program or a transaction for all methods just to performance test them does not seem feasible. Furthermore, many SAP customers do not allow creating objects that are not intended for productive use, which for obvious reasons excludes test programs and transactions. Please note that performance analysis of class methods is an addtion to traditional runtime analysis of transactions and programs, not a replacement.

Inspired by Hermann Grahm’s blog ST12 – tracing function modules, I decided to see how this concept works with transaction SAT and class methods. It is described in the following step-by-step guide in section 1-7.

By now, you probably wonder when ABAP Unit is getting into the picture. Now!

One problem with performance testing is when you are not using the same test data. Simply executing a method by pressing F8 and entering arbitrary test data will make it difficult to compare two test results. Full scale regression, integration, and acceptance testing covers these aspects. But here the focus is on unit testing. In most cases there is no test data repository for simple unit testing. Or is there? ABAP Unit!

I always write ABAP Unit for my methods.  By using ABAP Unit when performance analyzing class methods, I can ensure that the test data remains the same or at least it will be similar when doing future changes. This makes the test results more comparable. Lets get our hands dirty and see how it is done.

1. SAT – Settings

Start by opening transaction SAT and create a variant with the settings described in Olga Dolinskaja ‘s blog Next Generation ABAP Runtime Analysis (SAT) – How to analyze performance. In addition to the variant settings, make sure to check the option “Explicit Switching On and Off of Measurement” as shown in the screenshot below.

The ABAP Unit framework uses a multitude of classes. Add your class in the “Program Components” part of the variant setting to make the measurement result simpler.

2. SAT – In Dialog

Enter SE80 in the transaction field of the “In Dialog” section.

3. SAT – Execute

Press the “Execute” button.

4. Runtime Analysis – Switch On

In SE80, make sure that the “Repository Browser” is selected and that the class you want to test is displayed. Now you can switch on the runtime analysis by selecting “Switch On” via the menu “System->Utilities->Runtime Analysis”.

5. Run ABAP Unit

After switching on the runtime analysis, run the ABAP Unit test by righ-clicking on the class and choosing “Test->Unit Test”.

6. Runtime Analysis – Switch Off

Assuming that the ABAP Unit test ran successfully the measurement can now be switched off via the menu “System->Utilities->Runtime Analysis” or by pressing the “Cancel” button .

7. SAT – Display Measurement

The measurement results are displayed.

Switch to the “Programs” view to display the class specific measurements.

Check the class you want to analyze and select “Display Subareas in Time tool”.

The performance result of the method CAT_SAYS is 3 microsec. Keep in mind that normally ABAP Unit would call numerous methods and these would then also be displayed. This result can now be stored by the developer. Next time the method is updated it is easy to compare the new performance with the old result.

This blog covers performance analysis, but can easily be enhanced to also cover memory analysis. All you have to do is change the variant in Step 1 as described in Next Generation ABAP Runtime Analysis (SAT) – How to analyze memory consumption.

It would be great if SAP added an option to do runtime analysis directly when executing ABAP Unit tests. Especially when the tests are triggered from the coverage analyzer.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Naimesh Patel
    Hello Elvez,

    Great idea to measure the performance of the ABAP Unit methods. But, when we have to change the productive method, we need to first change the Test to make it fail before making the change – as part of TDD.

    Now, it speaks for itself that you need to make the change in Unit Test method only when there is some change required. To accomplish this, you may need to change the SETUP method to add some more test data as well as the change in the productive method. So, you need to keep in mind that performance difference of both versions of Unit Test must justify the need of the change method.

    IMHO, we should run the performance on the business transaction as a whole to pin point exact place where the bottleneck is.

    Naimesh Patel

    1. Bjorn-Henrik Zink Post author
      Hi Naimesh,

      thank for your comment.

      Let me start be making clear that I do not propose to exchange traditional performance testing via transaction, program, or function module. This is merely an add-on to enhance developer awareness of performance aspects. Timing is an important part of this idea. Lets for example say that your method is part of a complex integration flow. It can take weeks before a performance test is executed. Following this blog you will have a performance indication of your class method within five minutes.

      Regarding your comment on change, then I do agree with you. However, I did not write that the test data would be identical. I wrote the results would be more comparable. Even if you have to update your unit test, then I guess that the change is in most cases an extension on the previous test. Then it is up to the developer to analyze the test result to see if the change in logic is reasonable with the change in performance.

      Just some thoughts …


    2. Bruno Esperança

      Hi Naimesh,

      Your reply is not true if the change is due to performance issues. In this case you wouldn’t normally need to change the data. Also, if the user complains about poor performance in a multi-method process, being able to quickly compare the performance on a given method has a lot of value.

      Thanks Bjorn.

  2. Anshul Saxena


    I have followed the above steps for a class and executed its ABAP Units and still not getting analysis of the class.

    Can anybody help me?




Leave a Reply