Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SQL TRACE

Former Member
0 Likes
562

hi all experts,

see i have a program . then how can i go for the SQL Trace using Tcode - ST05

plz give me the steps.

if any one of u have any screen shots for showing the steps for SQL trace then plz send it to me otherwise just send me the steps only how to do it.

my id is - sanjeevsingh_sap@yahoo.com

thanks & Regards

sanjeev

1 ACCEPTED SOLUTION
Read only

Former Member
3 REPLIES 3
Read only

Former Member
Read only

Former Member
0 Likes
529

Steps for SQL Trace

1.create a small ABAP/4 program that contains only the select statement. Before proceeding, test it to ensure that it works.

2.Open that program in the editor so that it is ready and waiting to execute.

3.Open a new session using the menu path System->Create session.

4.Run transaction ST05 (enter /nst05-zero-five, not oh-five-in the Command field, or choose the menu path System->Utilities->SQL Trace). The Trace SQL Database Requests screen is displayed.

5.If the Trace SQL Status Information box reads Trace SQL is switched off, go to step 7.

6.At this point, the Trace SQL Status Information box contains Trace SQL switched on by, followed by the user id who turned on the trace and the date and time it was started. You must switch it off before you can proceed. If the trace was started within the past hour, it is possible that it is still being used. Contact the indicated user or try again later. If the trace was started hours or days ago, the user probably left it on by mistake and it can be safely turned off. To turn off the trace, press the Trace Off pushbutton. The message in the Trace SQL Status Information box should now read Trace SQL is switched off.

7.Press the Trace On pushbutton. The Trace SQL Database Requests dialog box is displayed. The DB-Trace for User field should contain your user ID. If your user ID is not in this field, enter it now.

8.Press the OK button. You are returned to the Trace SQL Database Requests screen and the status information reads Trace SQL switched on by, indicating that you turned on the trace.

9.Switch back to the window containing your editor session (the one with your program waiting to execute).

10.Press F8 to run your program. (Only press F8, do not do anything else, do not even press the Back button.)

11.When your program has run and the hourglass is no longer displayed, switch back to the trace window.

12.Press the Trace Off pushbutton. The status information reads Trace SQL is switched off.

13.Press the List Trace pushbutton. The Trace SQL Database Requests dialog box is displayed. The fields on this screen will already contain values.

14.Press the OK button. You might need to wait a little while, at most a couple of minutes. The Trace SQL: List Database Requests screen is displayed.

15.Type %sc in the Command field and press the Enter key. The Find dialog box is displayed.

16.Type the name of the table you are tracing in the Search For field. (This is the table named in the select statement in your ABAP/4 program.)

17.Press the Find button. A search results list should be displayed with your table name highlighted.

18.Click on the first highlighted table name. You are returned to the Trace SQL: List Database Requests screen. Your cursor is positioned on the first line containing your table name. To the right of it, in the Operation column, should be the word PREPARE, OPEN, or REOPEN.

19.Press the Explain SQL button on the Application toolbar. The Show Execution Plan for SQL Statement screen is displayed.

20.Scroll down to the execution plan. The index used will be displayed in blue.

Read only

Former Member