ABAP Debugging - Analyzing Memory Usage of Your Programs

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

Blog

PROGRAMMING
ABAP Debugging: Analyzing Memory Usage of
Your Programs
by SAP PRESS on April 13, 2020

Like SQL statements, one of the most-notorious causes of ABAP performance problems is internal
tables with many entries. Large internal tables consume massive amounts of memory and CPU, for
example, during copy, sort, or search operations.
 
You can use the ABAP debugger to create an overview of all internal tables of a program. The
ABAP debugger is a tool for performing functional troubleshooting in programs. You can find more
detailed descriptions of the debugger in SAP literature under ABAP programming. Youʼll find
information on main memory usage both in the classic and the new debugger. You can set the
debugger in the ABAP Editor (Transaction SE38) via Utilities > Settings > Debugging.
 
Performance analysis using the ABAP debugger isnʼt a standard procedure and is best performed
by an ABAP developer.
 
https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 1/8
Rules When Debugging
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

Take the following advice into account when working with the ABAP debugger. During the
debugging process, the ABAP program may terminate and display the error message Invalid
interruption of a database selection, or the system may automatically trigger a database
commit.
 
In either case, an SAP œṙ ḅḙǜǀ ḵĮ ṎḙẤṙ Ḃť ṙ ẃḮ ᾨœĮ ť ᾩhas been interrupted, and this may lead to
inconsistencies in the application tables. Therefore, you should only debug on a test system or in
the presence of someone who is very familiar with the program being analyzed and who can
manually correct inconsistencies in the database tables if necessary. See “Debugging Programs in
the Production Client” in SAP Online Help for the ABAP debugger.
 
You perform a performance analysis with the debugger as follows:
. Start the program to be analyzed. Then open a second session. Here you can monitor the
program to be analyzed in the work process overview (Transaction SM50). Enter the
debugger from the work process overview by selecting the Debugging function. By using
the debugger several times in succession, you can identify the parts of the program that
cause high CPU consumption. Often, these sections consist of LOOP ... ENDLOOP
statements that affect large internal tables.
. To display the current memory requirements (in the “classic” debugger), select Goto >
Other Screens > Memory Use.
. Check for cases of unnecessary memory consumption that may have been caused by a
nonoptimal program or inefficient use of a program. As a guideline, bear in mind that a
program being used by several users in dialog mode should not allocate more than 100MB.
. As of SAP NetWeaver AS ABAP 6.20, you can use the classic debugger to create a list of
program objects located in the memory by selecting Goto > Status Display > Memory Use.
Under Memory Consumption, the Ranking Lists tab contains a list of objects and their
memory consumption.
In SAP NetWeaver AS ABAP versions 4.6 und 6.10, you can obtain a memory consumption list by
choosing Goto > System > System Areas. Enter “ITAB-TOP25” in the Area field. This way, youʼll
obtain a list of the 25 largest internal tables.
 
https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 2/8
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

5. In the “new” debugger, you first display the memory analysis tool by clicking the button for
the new tool and then selecting Memory Analysis from the tools on offer in the Memory
Management folder. The initial screen then displays how much memory is allocated or used
by the analyzed internal session. Click the Memory Objects button to go to the list of the
largest memory objects, which can be the internal tables, objects, anonymous data objects,
or strings.
 
Memory Extracts
Moreover, you can create and then analyze a memory extract, that is, an overview of the objects
that occupy memory space. You can create a memory extract in any transaction by selecting
System > Utilities > Memory Analysis> Create Memory Extract or simply enter function code
“/HMUSA”. The third option is to create a memory extract from program coding. Refer to SAP Help
for a description of the system class CL_ABAP_MEMORY_UTILITIES.
 
To evaluate the memory extract, start the Memory Inspector by selecting System _ Utilities >
Memory Analysis > Compare Memory Extracts in any transaction or via Transaction
S_MEMORY_INSPECTOR. The Memory Inspector lists all memory extracts in the upper part of the
screen. In the lower part of the screen, you can find details about the individual memory extract.
 
Here, a distinction is made among the object types, programs, classes, dynamic memory request
of a class, table bodies, strings, and types of anonymous data objects. Youʼre provided with
different ranking lists, according to which you can sort the objects. For each memory object,
youʼre provided with the values of bound allocated, bound used, referenced allocated, and
referenced used memories. You can find a detailed description of the ranking lists and the
displayed values in SAP Help.
 
Memory Inspector
The Memory Inspector is particularly useful for examining transactions over a long period of time,
as is the case in a customer interaction center. Here, users frequently enter a transaction at the
beginning of their workday and exit it when they go home. In these “long-term” transactions, data
often remains, and therefore memory consumption continuously increases.
 
https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 3/8
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

The figure below shows an example of a memory extract. The dominator tree shows the
hierarchical program structure and the memory used by the program parts. With a size of 494MB,
table LT_MEM is conspicuous. The next largest object is the CL_GUI_ALV_GRID class with a size of
250 KB. Below this class, 130 KB are used by table MT_ATA.
 

 
Conclusion
In order to find potential performance bottlenecks, itʼs important to take a look at historical culprits
such as SQL and ABAP code. With tools such as the ABAP debugger and Memory Inspector,
analyzing the memory usage in your program becomes quite easy.
 
c ǨḙẤṙ ẃῑẎ Ṏṙ ẤǴ: This post has been adapted from a section of the book Ď! Ć ĆǴẃḂṙ ẃṊ ǀ ṎǜǴ
È ṿẤḙṊ ḙӢǀ Ấḙṙ Ṏ ä ẴḙǨǴῤ! Ṏǀ ḵӑӢḙṎḅ ǀ ṎǨ ẴṎḙṎḅ Ď! Ć ĎӑẎẤǴṊ Ẏ by Thomas Schneider.

Recommendation
https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 4/8
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

SAP Performance Optimization Guide:


Analyzing and Tuning SAP Systems
The speed and efficiency of your organization's
software is critical for business success. From
monitoring system workloads and optimizing SQL
statements, to identifying performance problems in
ABAP programs and sizing SAP HANA—learn how to
make your SAP system as agile as possible. Update
your skills for new technologies like SAP Fiori, SAP
Gateway, and SAP NetWeaver 7.5 and keep your SAP
system on top with the latest in SAP performance
optimization.
Learn More

by SAP PRESS
SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP
S/4HANA, SAP C/4HANA, SAP Leonardo, SAP Cloud Platform, and more!

Programming

Comments
https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 5/8
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

FIRST NAME*

LAST NAME

EMAIL*

WEBSITE

COMMENT*

protected by reCAPTCHA
Privacy - Terms

Submit Comment

Latest Blogs
PROGRAMMING
https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 6/8
What is the ABAP RESTful Programming Model?
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

Read More

PROGRAMMING
Exploring The ABAP Editor
Read More

Subscribe to our blog!


Get notified about future blog updates.
Your Email Address Subscribe

The official SAP PRESS Blog

https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 7/8
5/19/2020 ABAP Debugging: Analyzing Memory Usage of Your Programs

As the worldʼs leading SAP publisher, SAP PRESSʼ goal is to create resources that will help you accelerate
your SAP journey. The SAP PRESS Blog is designed to provide helpful, actionable information on a variety of
SAP topics, from SAP ERP to SAP S/4HANA. Explore ABAP, FICO, SAP HANA, and more!

SAP Blog Topics


All SAP Topics Administration Human Resources
Programming CRM & Sales Behind the Scenes
FICO Business Intelligence Featured
Logistics SAP HANA

Blog curated by
Visit the SAP PRESS Store

About
Home Legal Notes Guest Posting
About Us Privacy Policy
Contact Terms of Use

© 2020 Rheinwerk Publishing, Inc. | Change Privacy Options

https://blog.sap-press.com/abap-debugging-analyzing-memory-usage-of-your-programs 8/8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy