There are many reasons why a run-time error can occur such as un-handled exceptions, a resource or system problem or an error in coding. Let’s look a little deeper…
Tools for Troubleshooting Your ABAP Code
System Logs (TCODE – SM21)
When faced with a program that crashes, developers end up spending a lot of time debugging ABAP code to find and trace what went wrong. But they should know that SAP records all the warnings, exceptions and system errors in the System Log. So, when we get an error we can make best use of time by taking a good look at the System Logs first to help find and correct the errors in our code quickly and easily.

System Logs Go To Transaction SM21
To view the System Logs goto transaction SM21.
These are the different types of logs created by system log:
-
Local System Logs
-
Remote System Logs
-
All Remote System Logs
-
Central System Logs
In this tutorial we will see how to view the Local System logs, but the process is same for the other types of log files.
Click on the System Log menu button, select ‘Choose’ and you will see the different types of logs. Select ‘Local system logs’.
In the selection screen you have the option to provide the period, user, transaction, process and the program class.
After entering the details hit the F8 button or you can click on the ‘Reread System logs’ button provided at the top of the screen.
After execution is completed you will have a table with the system log entries depending on your selection criteria.
By double clicking on a specific entry you can view the detailed information.
Always use SM21 as a starting point to analyze an ABAP program for dumps and errors.
ABAP Runtime Error/ ABAP Dump Analysis (TCODE – ST22)
A runtime error is triggered when there is an un-handled exception or a system error in an ABAP program. By the help of this recorded runtime error you can pinpoint the problem and get to the solution quickly. To start the ‘ABAP Runtime Error’ go to Transaction code ST22.
You will find the standard option in the selection screen i.e. ‘Today’ and ‘Yesterday’ with the total number of run-time errors that have occurred during these periods.
In the ‘Own Selection’ section you can provide your own filters such as date, time, user and other parameters.
At the bottom of the screen you will find three important check boxes which by default are not selected.
- With information on Exception/Short Text of Runtime Error: Selecting it you can see the ‘short text’ of the runtime error with concise information. You can then navigate to the ‘Long Text’ from there
- The program affected: Selecting it you can see the program affected.
- Program and associated application components (long runtime): Selecting this check box you can see detailed in-depth relating to the program and its associated components.
If the runtime error is occurred today then you can press the push button ‘Today’ to go to the list of runtimes errors today.
Double clicking on a row will take you to the ‘Runtime Error Long Text’
Short Text: It gives us a short description of the runtime error.
What Happened? : This section gives the name of the program which requires correction.
What Can You Do? : Here you can see some suggestions.
Error Analysis: This section often provides really detailed information about the possible causes of the runtime error. This section is really important and you should go through it to get a head-up about the exact cause of the error.
How To Correct The Error: Here you will find some information on how you can possibly correct this error. Often by following the steps given in this you can correct your code or at least it will point you in the right direction.
Source Code Extract: This section gives the exact line number on the code where the runtime error was triggered. By double clicking on this you can navigate to the source code. This is very useful because it saves a lot of your time and without debugging you know the location of the bug which caused the runtime error.
The other sections provide you information regarding the list of variables and the programs affected.
In this tutorial we have seen that it is always a good idea to first analyze the logs and dumps before just blindly debugging your ABAP program which in turn helps you solve your coding issues in the least amount of time possible.