DATA : it_fcat TYPE lvc_t_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SPFLI' " Dictionary-Struktur
CHANGING
ct_fieldcat = it_fcat. " Feldkatalog
DATA: o_tab TYPE REF TO data.
* dynamische Tabelle aus dem Feldkatalog erstellen
cl_alv_table_create=>create_dynamic_table( EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = o_tab ).
* dynamische Tabelle auf Feldsymbol abbilden
FIELD-SYMBOLS: <tab> TYPE ANY TABLE.
ASSIGN o_tab->* TO <tab>.
* Daten holen
SELECT * FROM spfli INTO TABLE <tab> UP TO 10 ROWS.
* Daten anzeigen
DATA: o_alv TYPE REF TO cl_salv_table.
TRY.
cl_salv_table=>factory( IMPORTING
r_salv_table = o_alv
CHANGING
t_table = <tab> ).
o_alv->display( ).
CATCH cx_root.
ENDTRY.
Links