‎2007 Apr 03 11:56 PM
I guess I got a funny ques.. can someone answer this ?
I want to create a structure, with fields, a1,a2,a3...a10
is that possible I create some kind of counter, a(counter) and then keep on incrementing it without defining a1...a10
if it is possible, how do i acheive it ?
thanks.
‎2007 Apr 04 12:05 AM
‎2007 Apr 04 12:11 AM
So using what is in the blog, you code would be something like this. Run the program and check <dyn_wa> to see that it has your structure.
type-pools : abap.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
data: index(2) type c.
start-of-selection.
do 10 times.
clear xfc.
index = sy-index.
concatenate 'A' index into xfc-fieldname.
xfc-datatype = 'C'.
xfc-inttype = 'C'.
xfc-intlen = '10'.
append xfc to ifc.
enddo.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
check sy-subrc = 0.
Regards,
RIch Heilman
‎2007 Apr 04 12:16 AM
oh this is great stuff... yeah saw your blog and code and it runs neat while creation of dyn. internal table withdyn. fileds ..
just another aspect to my question, can we this couter arrangement while creating a sturcture in se11 or no ?
‎2007 Apr 04 12:45 AM