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

Syntax error in select statement

Former Member
0 Likes
2,532

This is the select statement it's giving syntax error,

  • Lesen Überschrifttabellen -------------------------------------------*

SELECT SINGLE * FROM T166U WHERE SPRAS EQ EKKO-SPRAS

AND DRUVO EQ XDRUVO

AND BSTYP EQ EKKO-BSTYP

AND BSART EQ EKKO-BSART.

How come it's not giving syntax error in production but it's giving in development server. Please help me with this.

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
1,896

Hi Thanvi, Try this way.


TABLES:t166u. " If you declare like this, it is not needed to use INTO clause in select query
SELECT SINGLE *
  FROM t166u
 WHERE spras EQ ekko-spras
   AND druvo EQ xdruvo
   AND bstyp EQ ekko-bstyp
   AND bsart EQ ekko-bsart.
Thanks Venkat.O

11 REPLIES 11
Read only

Former Member
0 Likes
1,896

Hi,

Is it giving error for destination field not given.

Is else, tell me the error.

Regards

Krunal Raichura

Read only

0 Likes
1,896

When I try to activate it gives Syntax error says ' The INTO clause is missing at SELECT, OR the From addition at either DELETE INSERT, UPDATE, MODIFY is missing.

Read only

0 Likes
1,896

Hello

Declare table T166U and error will disappear.


tables: T166U.

Read only

Former Member
0 Likes
1,896

Hi Thanvi

After fetching the data from database table,what do you want to do ?

do you want to do some operations ?

or

are you wnat the data to internal table?

SELECT SINGLE * FROM T166U into <workarea> WHERE SPRAS EQ EKKO-SPRAS

AND DRUVO EQ XDRUVO

AND BSTYP EQ EKKO-BSTYP

AND BSART EQ EKKO-BSART.

Edited by: Tulasi Palnati on Aug 26, 2009 2:51 PM

Read only

Former Member
0 Likes
1,896

>

> SELECT SINGLE * FROM T166U WHERE SPRAS EQ EKKO-SPRAS

> AND DRUVO EQ XDRUVO

> AND BSTYP EQ EKKO-BSTYP

> AND BSART EQ EKKO-BSART.

>

select single needs a into clause, as the table T166U would not have been declared as : TABLES : T166U.

but this is obsolete now. so..

data: gs_t166u type t116u.

SELECT SINGLE * FROM T166U
                              INTO  gs_t166u "add this
                          WHERE  SPRAS EQ EKKO-SPRAS
                              AND   DRUVO EQ XDRUVO
                              AND   BSTYP EQ EKKO-BSTYP
                              AND   BSART EQ EKKO-BSART.

>

> How come it's not giving syntax error in production but it's giving in development server. Please help me with this.

compare the code between(in version management) and check if those two are same or not.

Read only

venkat_o
Active Contributor
0 Likes
1,897

Hi Thanvi, Try this way.


TABLES:t166u. " If you declare like this, it is not needed to use INTO clause in select query
SELECT SINGLE *
  FROM t166u
 WHERE spras EQ ekko-spras
   AND druvo EQ xdruvo
   AND bstyp EQ ekko-bstyp
   AND bsart EQ ekko-bsart.
Thanks Venkat.O

Read only

Former Member
0 Likes
1,896

Hi ,

U Declare the Table name:

Tables: T166U

Hope its useful.

Regards,

Shankar Gj

Read only

Former Member
0 Likes
1,896

cross check the where condition.

there is no data element called XDRUVO.

it shopuld be DRUVO

Read only

Former Member
0 Likes
1,896

HI,

The error might occur bcoz there is not "Into" clause na. You are selecting only one row na, So you can use Workarea in the palce of internal table andthat work area name can be specified in that "Into" clause. This will clear problem. Ans also check whether you have specfied the tables.

Regards,

Dhanalakshmi L

Read only

Former Member
0 Likes
1,896

HI,

The error might occur bcoz there is not "Into" clause na. You are selecting only one row na, So you can use Workarea in the palce of internal table andthat work area name can be specified in that "Into" clause. This will clear problem. Ans also check whether you have specfied the tables.

Regards,

Dhanalakshmi L

Read only

sivakrishna_boddapati
Participant
0 Likes
1,896

hi,

if u select multiple rows then you put a internal table ,

if u select single row from data base u must put a work area , why should u get the data from the data base due to some modifications so it says errors like modify update ,change,insert

select * into table <itab> from <database table>condition.

select * into <WA_itab> from <database table > condition.