‎2005 Dec 15 3:54 PM
Hi there,
I'm using the FM 'GET_COMPONENT_LIST' to get the fields of a IT, but it's not working, I'm in 4.7
Not even in SE37 it's working.
there some restriction to use it in 4.7, or someone know another way to get the fields of a internal table?
Alexandre Nogueira
‎2005 Dec 15 3:57 PM
Here is a sample program. Implement it in your system. Does it work?
report zrich_0003.
types: begin of type_item,
f1(3),
f2(3),
f3(3),
f4(3),
end of type_item.
types: begin of type_data,
data(800),
end of type_data.
data: lineitems type table of type_item with header line,
t_output type table of type_data with header line,
fieldlist type table of rstrucinfo with header line,
fieldsym type table of rfieldlist with header line.
data: syrepid type sy-repid.
data: fieldname like fieldlist-compname,
data_line type type_data.
field-symbols : <fs1> type any,
<fs2> type any.
lineitems-f1 = 'a1'.
lineitems-f2 = 'a2'.
lineitems-f3 = 'a3'.
lineitems-f4 = 'a4'.
append lineitems.
lineitems-f1 = 'b1'.
lineitems-f2 = 'b2'.
lineitems-f3 = 'b3'.
lineitems-f4 = 'b4'.
append lineitems.
lineitems-f1 = 'c1'.
lineitems-f2 = 'c2'.
lineitems-f3 = 'c3'.
lineitems-f4 = 'c4'.
append lineitems.
lineitems-f1 = 'd1'.
lineitems-f2 = 'd2'.
lineitems-f3 = 'd3'.
lineitems-f4 = 'd4'.
append lineitems.
syrepid = sy-repid.
* Gets all of the global data types.
call function 'GET_GLOBAL_SYMBOLS'
exporting
program = syrepid
tables
fieldlist = fieldsym.
* gets all of the components of a structure
call function 'GET_COMPONENT_LIST'
exporting
program = syrepid
fieldname = 'lineitems'
tables
components = fieldlist.
format color 3.
loop at lineitems assigning <fs2> .
loop at fieldlist.
fieldname = fieldlist-compname .
assign component fieldname of structure <fs2> to <fs1>.
concatenate data_line <fs1> into data_line .
endloop.
append data_line to t_output.
clear data_line.
endloop.
loop at t_output.
write:/ t_output.
endloop.
Regards,
Rich Heilman
‎2005 Dec 15 4:28 PM
Yeap Rich, your program worked Ok.
The FM 'GET_GLOBAL_SYMBOLS' have worked to MY program, but 'GET_COMPONENT_LIST' did not... In Se37.
The problem is my report, to other reports it works, but I don't Know what is the problem.
Alexandre Nogueira
Message was edited by: Alexandre Nogueira
‎2005 Dec 15 4:30 PM
‎2005 Dec 15 4:42 PM
Oh man, you won't believe what is the problem... I found it out.
I was trying the use the FM GET_COMPONENT_LIST passing a IT that does not have header line, and it does not work.
The IT HAVE TO have a header line.
‎2005 Dec 15 4:43 PM
‎2005 Dec 15 5:02 PM
If you pass only a work area, it works, but if you pass a itab that does't have header line, it, does not work.
Try it in that sample program that you sent me today.
Alexandre nogueira