Code: Alles auswählen.
DATA:
gt_fieldcatalog TYPE lvc_t_fcat,
gz_table TYPE REF TO data,
gz_wa TYPE REF TO data,
g_struc_name TYPE dd02l-tabname VALUE 'RFCDES'.
FIELD-SYMBOLS:
<gt_table> TYPE ANY TABLE,
<gs_wa> TYPE ANY.
* Feldkatalog aus Struktur bauen
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = g_struc_name
CHANGING
ct_fieldcat = gt_fieldcatalog
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* ...
ENDIF.
* Zeiger auf dynamisch generierte Tabelle ermitteln
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = gt_fieldcatalog
IMPORTING
ep_table = gz_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc = 0.
* ...
ENDIF.
* Tabelle einem Feldsymbol zuweisen
ASSIGN gz_table->* TO <gt_table>.
* Arbeitsbereich dynamisch erzeugen
CREATE DATA gz_wa LIKE LINE OF <gt_table>.
ASSIGN gz_wa->* TO <gs_wa>.