ST05 Database Trace: How it is helpful to Functional consultant
You can trace the database using ST05 transaction to find out what tables / structures underlying program is using. It is extremely great tool to have when you want to analyze any transaction and there is just not enough information available over internet.
ST05 is used to analyze performance of programs majorly.
There are five important types of trace we can perform using ST05 and each is very important in specific context.
Note: This blogpost is a piece of eBook: Learn how to debug ABAP Programs. You can get the book by clicking on the link.
So let’s see how to use ST05
This is how ST05 screen looks like.
Here we have multiple options to filter trace of any program:
- SQL Trace: this trace helps to find out all tables and structures used by any program/transaction for performing statements like select, insert, delete and update
- Buffer Trace: to check table buffer (helpful to decide performance tuning opportunity area)
- Enqueue Trace: enqueue function is used to lock object at the time of updating data and then unlocking it after data update is finished. Many times, you receive errors like ‘xyz table is locked by user’ these errors are issued because of this enqueue function.
- RFC Trace: this is useful to find out if program is making any remote calls to another system. (useful when analyzing interfaces)
- HTTP Trace: to trace HTTP requests from program/application.
- SQL Trace
First we need to activate trace from ST05 transaction
There are two options to activate trace, you can see highlighted in above screenshot
One should always select activate trace with filter option
Get ECC & S4 Server access here.
In the next prompted screen (above) you should enter your username, transaction name and program name if possible for which you want to activate trace. In lower side you also have include and exclude options to narrow down the trace criteria.
Activating trace is a big deal. Because system collects huge data for analysis purpose, so be mindful while activating trace.
Now after entering filter criteria press enter and trace will be activated.
We are trying to trace FB03 transaction
Open FB03 transaction in other screen
Enter document details and press enter. You can keep going on like opening line item of journal entry or exploring various options from menu, system will keep recording trace of each and every activity. For this e.g. to keep it simple, we will just open journal enter and then close FB03 transaction.
Now go back to ST05 screen and deactivate trace
Then click on display trace option and execute report
And here you go, you got list of programs and objects (tables/structures) along with how much time it took.
You can double click on program name and system will take to that program statement.
To simplify this list further and we are also only interested table checked by FB03, hence we will go to aggregate trace option and select access to table (as displayed in below screenshot)
In next screen you will only see the list of tables that are used.
Let’s make it more simpler to understand, as we can see there are multiple tables that we might not be aware of.
Click on component hierarchy and select level 0 (as shown in below screenshot)
Read blogpost: Everything about FEBKO & FEBEP tables in SAP (EBS)
You can double click on table name to check table details.
In next screen you will see tables are segregated based on their modules
You can notice first BASIS tables are displayed under Basis Component head. Next Financial account tables are displayed. This will help you to check on right tables.
This was about SQL Trace.
Similarly you can use other trace to find out is there any RFC calls made or HTTP request in application. Many times you will come across multiple scenarios where you would like to know what this Z transaction do at that time instead of checking program line by line. You can simply activate all trace in ST05 and then analyze each trace separately.
This will save hours of time for you.
As discussed earlier this blogpost is taken from eBook Learn to read ABAP programs for functional consultants. If you found the blogpost useful then you can get your copy of eBook.
Stay tuned and connected with us on below platforms:
Thanks for reading.