Skip to Content
Former Member
May 16, 2008 at 04:07 AM

how to assign table name for select query in loop.


Hi friends my requirement is count the no of records of all the database table which comes into an internal table ."Check the below coding". Iam fetching the tables from dd03l table into an internal table .plz give me a sujjesion how to assign a table name in select query in a loop.

SELECT tabname FROM dd09l

INTO TABLE i_dd09l

WHERE protokoll = 'X'.

IF sy-subrc = 0.

SORT i_dd09l BY tabname.


LOOP AT i_dd09l.

SELECT COUNT(*) INTO val FROM i_dd09l-tabname.

IF sy-subrc = 0.

i_dd09l-count = val.


MODIFY i_dd09l INDEX sy-index.

CLEAR val.


error : 'I_DD09L-TABNAME' is not defined in the abap dictionary as a table.