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

Read table, table name in variable

Former Member
0 Likes
3,293

Hi all,

I am try trying to do the following.

Select statement to get the table name --> store in tname (variable).

Now, I have to do a select to read the data in this table (table name is in tname variable) based on some conditions

How do I do this?

1st step

Select ME_TECH from RSAC into tname

where NAME = 'PLANT'

and DATEFROM <= ldate

and DATETO >= ldate.

2nd step??

..........................................?

Thanks,

Anirudh.

6 REPLIES 6
Read only

Former Member
0 Likes
1,328

Use Field Symbols

Read only

0 Likes
1,328

Please elaborate.

Read only

Former Member
0 Likes
1,328

Hi,

Select * from (Tname) into corresponding fields of table ITAB1.

Note: the braces are close, there is no space between the brackets and the word.

Regards,

Subramanian

Edited by: Subramanian PL on Jul 22, 2008 1:41 PM

Read only

Former Member
0 Likes
1,328

Hi,

Please search in SDN with the keyword..Dynamic internal table..I am sure you will get lot of posts on this..which discuss about populating the data from a table name which is dynamic..

Thanks

Naren

Read only

Former Member
0 Likes
1,328
report ztest.

parameters: p_table type dd02l-tabname.

field-symbols: <fs> type standard table." of (p_table).


select * from (p_table)
into table <fs>
up to 20 rows.

There is another way using CL_ALV_TABLE_CREATE, for this you have to pass the fieldcatalog.

it return the internal table reference. using that you can proceed.

Read only

Former Member
0 Likes
1,328

Hi,

When u want to fetch the data in a variable use select single stmt.

select single ME_TECH from <tablename>

into <variable name>

where <conditions>

Sharin.