05-14-2009 12:57 PM
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.
05-14-2009 12:59 PM
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
05-14-2009 1:15 PM
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