Application Development 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: 

ST05 - Explain SQL

Former Member
0 Kudos

Hi all,

I'm using version 4.6C and I want to fine tune my SQL using the Explain SQL function, however I am having difficulty understanding what syntax to use in the tool.

Effectively I want to understand more about the performance of the following statement:-

select cpident tabkey

from bdcps

join on bdcp

where bdcpscpident = bdcpcpident

where bdcps~mestype = 'XXXXXXXX'

and bdcps~process = ' '.

However ST05 doesn't seem to understand what I am typing and keeps giving me an error, saying 'Change update/delete to select if possible', what format of the above statement would ST05 recognise?

Thanks in advance,

Stephen

1 ACCEPTED SOLUTION

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Stephen,

something out of topic:

use view BDCPV instead of a join. That's the common way and you might profit from buffering.

Regards,

Christian

9 REPLIES 9

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Your select statement should be:

Here itab should be declared as internal table holding the two fields mentioned in select.

select cpident tabkey

from bdcps

join bdcp into table itab

on bdcpscpident = bdcpcpident

where bdcps~mestype = 'XXXXXXXX'

and bdcps~process = ' '.

0 Kudos

Thanks Jayanthi,

However, I really want to know how I would enter this statement in the the ST05 Explain SQL statement transaction (as this would help me in the future for other queries), I just can't get ST05 to understand my query.

Regards

Stephen

0 Kudos

Hi,

step 1:Create a ABAP Program.

Step 2:Activate the program without errors.

Step 3:Go to ST05 Transaction

Step 4:Check mark SQL Trace.

Step 5:Click Trace on

Step 6:Execute the program

Step 7:Trace off

Step 8:List trace

Former Member
0 Kudos

select acpident atabkey

into table i_tab

from bdcps as a

inner join bdcp as b

ON acpident = bcpident

where a~mestype = 'XXXXXXXX'

and a~process = ' '.

Try this one. Ur Select query was wrong.

SQL Trace

SQL trace(ST05) provides the developer with the ability to analyse database select statements. Simply execute ST05

to turn on SQL trace, then execute the statement/program you want to analyse. Now turn off SQL trace using ST05

and click on list trace to view the details.

You can also perform traces on other items such as authorisation objects.

http://www.sapdevelopment.co.uk/security/authority/authority_authtrace.htm

Hope this helps.

0 Kudos

Thanks Judith,

However ST05 doesn't like this syntax either:-

select acpident atabkey

into table i_tab

from bdcps as a

inner join bdcp as b

ON acpident = bcpident

where a~mestype = 'XXXXXXXX'

and a~process = ' '.

Just for clarification, I am using ST05, hitting the 'Explain one SQL request' button, this then takes me to a screen where I can enter a specific statement. I want to learn how to use this transaction, rather than having to create an ABAP program each time. It would be handy to get an immediate verdict on what my statement will do in the system.

0 Kudos

http://www.sapdevelopment.co.uk/perform/perform_sqltrace.htm In this link it is mentioned u can <b>execute the statement/program you want to analyse</b>.

Just check this out.

Just to add, u cant run the trace without any program it will work together when u run a report.

Make sure to turn off the trace or else it will run and slow down the system performance.

So u cant run for an individual slect, u have to write a program and run.

Hope u got it.

If u have solved ur problem kindly reward and close the thread.

Message was edited by: Judith Jessie Selvi

0 Kudos

0 Kudos

Hi,

Go to ST05->Explain one SQL statement.

Type in Uppercase.

SELECT * FROM MARA

No fullstop should be given.

Then click Explain.

You can see the trace.

Hope this solves your problem.If so,kindly close the thread by rewarding points.Otherwise,get back.

Did you tried?

Message was edited by: Jayanthi Jayaraman

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Stephen,

something out of topic:

use view BDCPV instead of a join. That's the common way and you might profit from buffering.

Regards,

Christian