There is a phase in development cycle when the programmer needs to optimize his final product. This post focuses on those transactions which help developers to analyse, debug and optimize already finished reports and programs.
This post is part of series about SAP transaction codes for ABAP Developers:
- Basic SAP transactions for ABAP developers
- How to modify and extend SAP applications
- Transaction codes for database and table handling
- How to analyse, debug and optimize your SAP programs with standard tools
SAP system offers several options how to analyze our programs. Let’s start with the debugger.
There are basically two options how to use a debugger. You can either start the debugger when you set a session break point in your code while using se80 or se38. When you run the program additional window with (new) debugger will show up.
The other method to is enter one of these following codes into command field just before you run the report:
- /h – basic and most used command which will run the debugger
- /hs – start debugger and allow system debugging
- /ha – start debugger, skip screen handling and start directly debugging ABAP code
- /hmusa – start debugger and create memory snapshot which can be analysed in transaction S_MEMORY_INSPECTOR
S_MEMORY_INSPECTOR – Memory inspector
We are able to generate a memory snapshot from any report or ABAP debugger and then analyse it in S_MEMORY_INSPECTOR transaction. Apart from /hmusa mentioned above, we can also use following techniques to generate memory snapshot:
- To create snapshot from any running program, we need to select main menu > System > Utilities > Memory Analysis > Create snapshot.
- To create snapshot from ABAP debugger, we need to start memory analysis tool, select tab Memory Objects and generate snapshot. (more info on memory analysis tool can be found here)
Once the snapshots are generated, we can analyse them and compare them. It can help us to find any memory leaks or discover why the memory consumption is unexpectedly increasing over time.
SE30 / SAT – Runtime analysis
SE30 is an older transaction which is replaced by transaction SAT since EHP2. SAT is a powerful tool which allows you to run any transaction, program or function module and evaluate the runtime analysis right after. Hit list will display all statements (blocks) of the program and their running times. We will use this list to track down inefficient parts of program and optimize it afterwards. Similarly, hit list of DB tables shows us list of database access which can help us to optimize database queries.
SAT also keep track of old measurements which are accessible via Evaluate tab. It gives us opportunity to see the overall improvements or compare different runs of our program.
Very complex tutorial about runtime analysis can be found here.
ST22 – ABAP runtime errors (tracking dumps in SAP system)
Every ABAP developers had experienced some dump in his program, whether because of the syntax error or some other inconsistent system state. You are able to take a look into debugger afterwards what has happened. On top of that, transaction ST22 keeps track of all dumps which happened in the system and you can recall any one of them. This is very handy when user wants to report you the dump, you just select dump according to his system name and you can start debugging and fix it immediately.
SCU3 – Evaluate change logs
This transaction enables you to see change logs of tables and customizing objects (views, tables, view clusters generated by sm30). You need to first set up logging in se11 > technical settings of the table. You will able to see all changes over the time in transaction SCU3. Performance will be indeed affected, choose such tables very carefully.
ST02 – The buffer monitor & Tune summary
Transaction ST02 is rather aimed for SAP basis person than for a developer. It shows the usage of buffers and memory of that SAP instance where we are currently logged in. It provides information about buffers, sap memory, cursor cache and call statistics from the time the instance was started. As a developers we will use this transaction rarely, but may be handy to prove that system is slow and it is not fault of our program.
ST04 – Database performance analysis
Since ST04 is used by SAP basis people too, I am not going to describe this transaction in detail. It shows historical and current data of a database usage and it provides those kinds of information which can help us to evaluate and improve overall database performance on a whole system level. For more information check out following blog post.
ST06 – OS Monitor
ST06 is another basis tool. It provides overview of all kind of resources in our system, such as CPU, memory, SWAP, disc and network. For more information see following blog post.
As usual, I hope you enjoyed this article and looking forward to hear your feedback.