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

How to run an SQL-statement interactiv

Former Member
0 Likes
1,299

Hi Experts,

i want to test some SQL-Statements. For example: Select count(*), <field> from <table>

Is there any transaction in SAP to do this?

Thanks in advance.

Regards

Achim

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
949

As far i know there is no standard transaction , but you can create one for you.

Its not that tough !!!!

Edited by: karthik arunachalam on Sep 2, 2008 11:03 PM

6 REPLIES 6
Read only

leif_almgren
Participant
0 Likes
949

This was also my first question when I started with ABAP development. I don't think such a transaction exists, and I have asked several experienced developers. So for now I have settled with using SQVI (Quick Viewer), but things like count(*) is of course not possible. I am watching this therad with great interest, hoping someone will provide a better alternative!

Another option I have considered is to use an external SQL tool for the database, but we use an Orcale DB and the default Windows SQL tool is not a very good solution (not to mention that you need to convince the DB admin to allow it).

Read only

Former Member
0 Likes
950

As far i know there is no standard transaction , but you can create one for you.

Its not that tough !!!!

Edited by: karthik arunachalam on Sep 2, 2008 11:03 PM

Read only

Former Member
0 Likes
949

What is the intended purpose?

If you want to test if it is pulling the correct data, it hardly takes any time to write a simple report with the select statement in DEV and see if it is pulling the right data.

If you are concerned of the performance of that particular select in Production, you can use the ST05 tool to analyse the SQL statement. This will not give you the data, but will give you the performance.

Read only

0 Likes
949

For general syntax errors and some information about performance, in ST05 the [Enter SQL Statement] could do the job.

for example:

select * from mara where mandt = :a1

[Explain] indicates, among other information:

- estimated cost

- estimated #rows

- best index to use in thr query

Regards.

Read only

0 Likes
949

>

> If you want to test if it is pulling the correct data, it hardly takes any time to write a simple report with the select statement in DEV and see if it is pulling the right data.

I would like to argue with that. If you are trying to create a complex nested SQL query, I think it is much quicker to be able to try out different variants of the SQL statement without having to build the code around it to present the results.

Read only

Former Member
0 Likes
949

There is a way to look at the result set from ST05. Afer you see the result of the EXPLAIN screen, select SQL commands under the diagnostics folder on the left sidebar. Enter the query into the middle box on the right hand side and click on execute to view the results below the query.