Application Development 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: 

To select data from database table detrmined dynamically.

Former Member
0 Kudos

Hi Experts ,

Need to get data from database tables that is determined dynamically .

I have the database table name stored in a string while execution.

How to can this be passed in the select query in order to get the contents of the table?

Regards.

2 REPLIES 2

Former Member
0 Kudos

HI,

REPORT demo_select_dynamic_database . 

DATA wa TYPE scarr. 
DATA name(10) TYPE c VALUE 'SCARR'.

SELECT * 
INTO wa 
FROM (name) CLIENT SPECIFIED 
WHERE mandt = '000'. 
WRITE: / wa-carrid, wa-carrname. 
ENDSELECT.

Thanks

Sudheer

Former Member
0 Kudos

Hi Sunitha,

check this out:


    SELECT  (l_t_selflds) FROM       (p_g_ztab_name)
                          INTO TABLE <g_t_table>
                          WHERE      (l_t_whereflds).

Here (p_g_ztab_name) is the name of the variable that contains the value of table. You can code accordingly.

Regards

Shital