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

To select data from database table detrmined dynamically.

Former Member
0 Likes
449

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
Read only

Former Member
0 Likes
408

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

Read only

Former Member
0 Likes
408

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