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 select 3 fields using a select statement

Former Member
0 Likes
2,235

hi,

i need to select 6 fields into some global variable,

what is the syntax for that.

1 ACCEPTED SOLUTION
Read only

suresh_datti
Active Contributor
0 Likes
1,342

HI,

Use the following satetments..

data: w_field1 type dbtab-field1,

w_field2 type dbtab-field2,

w_field3 type dbtab-field3.

select field1 field2 field3 from dbtab

into (w_field1,w_field2,w_field3)

where (your conditions).

endselect.

regards,

Suresh Datti

5 REPLIES 5
Read only

suresh_datti
Active Contributor
0 Likes
1,343

HI,

Use the following satetments..

data: w_field1 type dbtab-field1,

w_field2 type dbtab-field2,

w_field3 type dbtab-field3.

select field1 field2 field3 from dbtab

into (w_field1,w_field2,w_field3)

where (your conditions).

endselect.

regards,

Suresh Datti

Read only

Former Member
0 Likes
1,342

u can do like this

data : begin of itab occurs 0,

fld1 type ztab-fld1,

fld2 type ztab-fld2,

fld3 type ztab-fld3,

fld4 type ztab-fld4,

fld5 type ztab-fld5,

fld6 type ztab-fld6,

end of itab.

data :workarea like itab.

select single fld1

fld2

fld3

fld4

fld5

fld6

from ztab

into workarea.

CONCATENATE workarea-fld1 workarea-fld2 workarea-fld3 workarea-fld4 workarea-fld5 workarea-fld6 into global variable

pls award points and close if ur problem is solved

Message was edited by: chandrasekhar jagarlamudi

Read only

Former Member
0 Likes
1,342

Hi,

SELECT SINGLE bukrs butxt INTO (t001-bukrs, t001-butxt)

FROM t001

WHERE bukrs = '0001'.

Cheers

JK

Read only

Lakshmant1
Active Contributor
0 Likes
1,342

Hi Anitha,

Have a look at demo programs

DEMO_SELECT_SINGLE

DEMO_SELECT_SINGLE_FIELDS

DEMO_SELECT_SOME_COLUMNS

DEMO_SELECT_ALL_COLUMNS

Hope this helps.

Thanks

Lakshman

Read only

Former Member
0 Likes
1,342

Hi Anitha,

You can select to the global variables or you can select into the table & move then accordingly.

select value1 value2 value3 value4 value5 value6

from <dbtab>

into ( dbtab-value1, dbtab-value2, dbtab-value3, dbtab-value4, dbtab-value5, dbtab-value6 )

where ....

<b>OR</b>

declare the fields as the database table fields...

select value1 value2 value3 value4 value5 value6

from <dbtab>

into ( v_value1, v_value2, v_value3, v_value4, v_value5, v_value6 )

where ....