11-16-2006 1:32 PM
Hi,
I have 10 internal table named table1, table2, ...table10. At run time I want refer to these tables dynamically as follows
table<num>-column = 'value'.
<num> will be known only during runtime. It may be any table from table1 to table10 based on different tables. So to minimize coding I want to give the internal table name dynamically.
How to achieve this?
Regards,
Sathish
11-16-2006 1:34 PM
u need to write dynamic code which picks up the required table at run time.
11-16-2006 1:36 PM
i need a clarification
ur using 10 internal table those structure are same or different
if they are same
depends on condition u can use those and tell me the brief description wr ur using those tables so,i can further help u
11-16-2006 1:48 PM
The structure of the table will be the same. From a parent internal table based on some conditions internal tables has to be populated, but what ever is the condition may all the tables should be filled in order only ie table1, table2...Some times only one table may get filled some times 9 tables.
I can write code by hardcoding each internal table names but I like to refer to internal tables dynamically. So is it possible to do as follows
num = 1.
loop.
table<num>-column1 = 'Value'.
num = num + 1.
endloop.
-Sathish
11-16-2006 1:45 PM
Hi,
One idea I can give is maintain an internal table whose line type is the Table type of your 10 internal tables. Then at run time if you know the NUM then read from this internal table.
READ TABLE it_tab_of_tabs into <field-symb> index num.
This is possible if all your 10 internal tables are of the same type.
Regards,
Sesh