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

Select Statement + constant

Former Member
0 Likes
5,188

Hi All,

I have a simply question. I have experience with microsoft SQL.

Can i use in ABAP SQL something else

SELECT column1 column2 'ABC'

FROM ...

INTO ....

'ABC' - some constant

Thanks for advice in advance

Martin

6 REPLIES 6
Read only

Former Member
0 Likes
2,280

Hi,

No,You can't use constants, use only the Fields that are present in the Table in the Select statement in ABAP.

Regards,

Anji

Read only

Former Member
0 Likes
2,280

Hello Martin,

Only u can select the fields from the table.

In ur case u can do like this:

SELECT column1 column2 column3
FROM ...
INTO ....
where column3 = 'ABC'   "  CHECK HERE

Vasanth

Read only

Former Member
0 Likes
2,280

HI Martin

In select statement the fields should be in the table from which we are retrieving the data , and u need to give the names of fields only in that syntax , u can not use other than the fields of that table ,it will give a syntax error in this case.

Read only

Former Member
0 Likes
2,280

Hi Martin,

As u are aware that, Select statement is basically used to get data from Database tables u cant select constants from it as u need to specify the fields names which u want to select from the DBtable.

Use

Select * from dbtable into corresponding fields of table itab.

Regards,

Priyanka.

Read only

Former Member
0 Likes
2,280

hi,

this wont work because u have to specify only the fields present in the table that is in the from clause.

regards.

Read only

Former Member
0 Likes
2,280

Hi,

Can you explain ur requirement?

Why wull you have constants as fields in tables

are you looking for this

tables mara.

select single matnr  from mara into mara-matnr where matnr eq 'ABC'.