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

ST05 Enter SQL Statement

pre
Explorer
0 Likes
1,644

Friends,

I am trying to use : enter SQL statement at ST05 to get cost of SELECT QUERY.

Each time I try, get following error message:

SQL error 102: Incorrect syntax near ':'.

Message no. SMMSS_ANALYZE000

Even for simple SELECT QUERY:

SELECT *

from mara

where mandt = :a1

I get the same error message. Please help me get solution for it as I searched SAP NOTE and could not find anything related.

Following are the details for our database:

Database system: MSSQL

Release: 9.00.4035

Thanks

1 ACCEPTED SOLUTION
Read only

HermannGahm
Product and Topic Expert
Product and Topic Expert
0 Likes
1,072

Hi,

> Each time I try, get following error message:

> SQL error 102: Incorrect syntax near ':'.

> Message no. SMMSS_ANALYZE000

>

> Even for simple SELECT QUERY:

> SELECT *

> from mara

> where mandt = :a1

> Following are the details for our database:

> Database system: MSSQL

> Release: 9.00.4035

you must not use native ORACLE syntax on MSSQL.

Furthermore the 'Enter SQL Statement' in MSSQL has some issues...

Try like this:

SELECT *

from MARA

where MANDT = '000'

(uppercase, ...)

Workarround:

Simulate your SQL with SE16 and record a regular ST05 trace.

Kind regards,

Hermann

Edited by: Hermann Gahm on May 25, 2010 5:03 PM

5 REPLIES 5
Read only

HermannGahm
Product and Topic Expert
Product and Topic Expert
0 Likes
1,073

Hi,

> Each time I try, get following error message:

> SQL error 102: Incorrect syntax near ':'.

> Message no. SMMSS_ANALYZE000

>

> Even for simple SELECT QUERY:

> SELECT *

> from mara

> where mandt = :a1

> Following are the details for our database:

> Database system: MSSQL

> Release: 9.00.4035

you must not use native ORACLE syntax on MSSQL.

Furthermore the 'Enter SQL Statement' in MSSQL has some issues...

Try like this:

SELECT *

from MARA

where MANDT = '000'

(uppercase, ...)

Workarround:

Simulate your SQL with SE16 and record a regular ST05 trace.

Kind regards,

Hermann

Edited by: Hermann Gahm on May 25, 2010 5:03 PM

Read only

matt
Active Contributor
0 Likes
1,072

If you do an SQL trace, and then explain a statement, you'll see precisely the form to enter an SQL statement in.

For example:

SELECT *
from "MARA"
where "MANDT" = :a1

If it helps you feel better, I only figured this out a few weeks ago - and I've been doing ABAP since 1997!

matt

Read only

HermannGahm
Product and Topic Expert
Product and Topic Expert
0 Likes
1,072

Hi Matt,

on MSSQL this would be:

SELECT *

from "MARA"

where "MANDT" = @P000

The problem is, that this doesn't work in ST05 on MSSQL:

SQL error 137: Must declare the scalar variable "@P000".

Message no. SMMSS_ANALYZE000

that is the ST05 issues in MSSQL i mentioned. In ORACLE

you are right... it works like you said.

Kind regards,

Hermann

Read only

matt
Active Contributor
0 Likes
1,072

Good point, well presented - I missed the MSSQL bit.

Read only

Former Member
0 Likes
1,072

This is the take home message of this thread:

Workarround:

Simulate your SQL with SE16 and record a regular ST05 trace.

For simple statements you should use the SE16 (table data display) and trace it in parallel.

This can also be useful when you analyse an SQL trace. If a problem can not be explained at all., run a single selection for a test, maybe it behaves quite different.

Siegfried