FORM fieldcat_merge CHANGING ch_fcat TYPE lvc_t_fcat.
DATA: lo_structdescr TYPE REF TO cl_abap_structdescr.
DATA: lo_elemdescr TYPE REF TO cl_abap_elemdescr.
DATA: ls_dummy TYPE gty_alv.
DATA: lt_fields TYPE ddfields.
DATA: lt_comp TYPE abap_component_tab.
DATA: lt_comp_final TYPE abap_component_tab.
DATA: ls_dfies TYPE dfies.
DATA: lv_lines TYPE i.
FIELD-SYMBOLS: <line> TYPE lvc_s_fcat,
<comp> TYPE LINE OF abap_component_tab,
<field> TYPE dfies.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~-{ DO }-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
"Erstellen der Strukturbeschreibung
lo_structdescr ?= cl_abap_structdescr=>describe_by_data( ls_dummy ).
IF lo_structdescr IS BOUND.
lt_fields = cl_salv_data_descr=>read_structdescr( lo_structdescr ).
CLEAR ch_fcat[].
LOOP AT lt_fields ASSIGNING <field>.
APPEND INITIAL LINE TO ch_fcat ASSIGNING <line>.
<line>-fieldname = <field>-fieldname.
<line>-rollname = <field>-rollname.
<line>-domname = <field>-domname.
<line>-tabname = <field>-tabname.
<line>-coltext = <field>-reptext.
<line>-scrtext_l = <field>-scrtext_l.
<line>-scrtext_s = <field>-scrtext_s.
<line>-scrtext_m = <field>-scrtext_m.
<line>-rollname = <field>-domname.
<line>-col_opt = 'X'.
<line>-ref_field = <field>-reffield.
<line>-ref_table = <field>-reftable.
ENDLOOP.Code: Alles auswählen.
IF gv_flag = 'X'. DESCRIBE TABLE gt_alv LINES lv_lines. IF <field>-fieldname+0(lv_lines) = 'TABU'. <line>-edit = 'X'. ENDIF. CLEAR: lv_lines. ENDIF.
ENDIF.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~-{ EN
ENDFORM. "fieldcat_merge
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
hmaxi96