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

Native SQL

Former Member
0 Likes
578

I am using an Open SQL statement to query the Oracle database that supports

our R3 system. The query runs very slow, and I would be interested in seeing

the actual query that is executed on the database ( the one that the database

utility creates).

Is there a way of doing this?

1 ACCEPTED SOLUTION
Read only

LeonardoAraujo
SAP Mentor
SAP Mentor
0 Likes
560

Sure.

Go to ST05.

There you can either do the following:

ACTIVATE the trace;

RUN your report'

DEACTIVATE the trace;

then DISPLAY trace....

Other option that is easier:

Click on ENTER SQL STATEMENT.

There you can cut and paste the statement as shown on SM50 (while running your report, you should go to SM50 and see the workprocess you are using, It should show something like SEQUENTIAL READ... etc). Double click on the work process and you should have a screen with more details, there you will see the SQL statement (the arguments are different than in code).

Copy it all and past on the ENTER SQL STATEMENT.

Run and you will get a result showing which indexes used, etc.

Leonardo De Araujo

3 REPLIES 3
Read only

Former Member
0 Likes
560

Use the EXPLAIN function in ST05.

Rob

Read only

LeonardoAraujo
SAP Mentor
SAP Mentor
0 Likes
561

Sure.

Go to ST05.

There you can either do the following:

ACTIVATE the trace;

RUN your report'

DEACTIVATE the trace;

then DISPLAY trace....

Other option that is easier:

Click on ENTER SQL STATEMENT.

There you can cut and paste the statement as shown on SM50 (while running your report, you should go to SM50 and see the workprocess you are using, It should show something like SEQUENTIAL READ... etc). Double click on the work process and you should have a screen with more details, there you will see the SQL statement (the arguments are different than in code).

Copy it all and past on the ENTER SQL STATEMENT.

Run and you will get a result showing which indexes used, etc.

Leonardo De Araujo

Read only

Former Member
0 Likes
560

You can use also ST04 for that. It shows the ORACLE database sessions (If you don't know the Oaracle session that belongs to the work process you have the "Client PID" column in ST04 wich is the "PID" in the SM50 monitor.

Open ST04:

  • Look for Status ACTIVE .

  • Under SQL Statement you see the plain statement text

  • doubleclick the line

  • You get the statement dialog

  • Click Execution plan button (the tool button)

  • You get the execution plan where you can click the tables or indexes for further information