‎2007 Feb 21 10:17 AM
hi experts,
DATA: temp(20) VALUE 'DATA',
i TYPE I VALUE 1,
J(2) type c.
LOOP AT l_t_tsi.
J = I.
CONCATENATE TEMP J INTO COLNAME.
itab-(COLNAME) = l_t_tsi-time_series_value.
i = i + 1.
ENDLOOP.
My internal table (itab) has fields data1(20), data2(20), data3(20)...
I want to generate the column names dynamically only.
The above code gives an error at this line -
itab-(COLNAME) = l_t_tsi-time_series_value.
Thanks in advance,
Bijal
‎2007 Feb 21 10:19 AM
‎2007 Feb 21 10:20 AM
its not possible in this fashion. but if you tell us what you want do by doing this, may be we could come up with better option
‎2007 Feb 21 10:22 AM
hi,
mentioning colname gives itab does not contain colname field.
thanks
‎2007 Mar 26 9:23 AM
Hi,
If your aim is to refer to a internal table field dynamically you can do it.
Look at the code segment below -
DATA: temp(20) VALUE 'DATA',
i TYPE I VALUE 1,
J(2) type c.
FIELD-SYMBOLS: <ls_data>.
LOOP AT l_t_tsi.
J = I.
CONCATENATE TEMP J INTO COLNAME.
<b>ASSIGN COMPONENT colname OF itab TO <ls_data>.
<ls_data> = l_t_tsi-time_series_value.</b>
*itab-(COLNAME) = l_t_tsi-time_series_value.
i = i + 1.
ENDLOOP.
Regards,
Manish Joshi
If it solves your problem, close the thread.
Don't clutter-up forum by leaving open threads.