There are multiple ways of making use of the subclasses of cl_abap_typedescr to get info on runtime instance data objects in ABAP. This is just one of the ways to get the columns of an internal table where its line structure has includes.
Suppose you start with an internal table named “table”
DATA table_descr TYPE REF TO cl_abap_tabledescr. DATA struct_descr TYPE REF TO cl_abap_structdescr. DATA columns TYPE abap_compdescr_tab. FIELD-SYMBOL <column> LIKE LINE OF columns. table_descr ?= cl_abap_typedescr=>describe_by_data( table ). struct_descr ?= table_descr->get_table_line_type( ). columns = struct_descr->components. LOOP AT columns ASSIGNING <column>. [do something with] <column>-name. ENDLOOP.
cl_abap_structdescr also has a GET_COMPONENTS( ) method but it doesn’t return a flat structure (doesn’t unpack includes). Of course, this doesn’t do any error checks and would crash if “table” isn’t a table.