И еще примерчик для полноты ощущений
Code:
REPORT YTEST message-id 00.
data : t_field_catalog type lvc_t_fcat,
t_table type ref to data.
data : datavalue type ref to data.
data : wtype type c.
data : wcomponents type i.
field-symbols : type table.
field-symbols : type any.
field-symbols : type any.
parameters : p_table type dd02l-tabname.
start-of-selection.
perform validate_table_name.
perform build_field_catalog.
perform get_table_data.
form validate_table_name.
data : l_dd02l like dd02l.
select single * into l_dd02l from dd02l where tabname eq p_table.
check sy-subrc ne 0.
message s398 with text-001 text-002.
stop.
endform.
form build_field_catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table
CHANGING
ct_fieldcat = t_field_catalog.
endform.
form get_table_data.
call method cl_alv_table_create=>create_dynamic_table
exporting it_fieldcatalog = t_field_catalog
importing ep_table = t_table.
assign t_table->* to .
select * into corresponding fields of table
from (p_table) up to 10 rows.
if [] is initial.
message s398 with text-003 p_table.
stop.
endif.
create data datavalue type (p_table).
assign datavalue->* to .
describe field type wtype components wcomponents.
loop at
assigning .
do wcomponents times.
assign component syst-index of structure to .
write : / .
enddo.
endloop.
endform.