Skip to Content
0
Former Member
Jun 26, 2012 at 12:06 AM

Getting internal table information at runtime

81 Views

Hi All

I am trying to create a method that will automatically create a field catalog based on INTERNAL TABLE input. I have found the following for determining components within a database structure. I am wondering if there is a equivalent for internal tables?

Does anyone know if there is a function/method available to automatically create a field catalog based on lvc_t_fcat? Yes I know there is the REUSE_ALV_FIELDCATALOG_MERGE but this only works for FM ALV. I have thought about wrapping this function but would prefer to do it the 'tricky' way.

DATA table_descr TYPE REF TO cl_abap_tabledescr.

DATA struct_descr TYPE REF TO cl_abap_structdescr.

DATA columns TYPE abap_compdescr_tab.

table_descr ?= cl_abap_typedescr=>describe_by_data( itab ).

struct_descr ?= table_descr->get_table_line_type( ).

columns = struct_descr->components.