Code: Alles auswählen.
LOOP AT alv_fields INTO wa_feldkatalog.
IF p_detail NE 'X'.
IF wa_feldkatalog-fieldname = 'MATNR'.
wa_feldkatalog-no_out = 'X'.
MODIFY alv_fields FROM wa_feldkatalog.
ENDIF.
IF wa_feldkatalog-fieldname = 'LGORT'.
wa_feldkatalog-no_out = 'X'.
MODIFY alv_fields FROM wa_feldkatalog.
ENDIF.
IF wa_feldkatalog-fieldname = 'LIFNR'.
wa_feldkatalog-no_out = 'X'.
MODIFY alv_fields FROM wa_feldkatalog.
ENDIF.
IF wa_feldkatalog-fieldname = 'WEMPF'.
wa_feldkatalog-no_out = 'X'.
MODIFY alv_fields FROM wa_feldkatalog.
ENDIF.
ENDIF.
ENDLOOP.
Code: Alles auswählen.
LOOP AT catalog INTO catalog_wa.
CASE catalog_wa-fieldname.
WHEN OTHERS.
READ TABLE tab WITH KEY (catalog_wa-fieldname) = space
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
catalog_wa-no_out = 'X'.
MODIFY catalog FROM catalog_wa.
ELSE.
CONTINUE.
ENDIF.
ENDCASE.
Code: Alles auswählen.
FIELD-SYMBOLS:
<field> TYPE ANY,
<itdata> TYPE itdata,
<ltfdcat> TYPE slis_fieldcat_alv,
<itfdcat> TYPE slis_fieldcat_alv.
DATA: wafdcat TYPE slis_fieldcat_alv.
DATA: ltfdcat TYPE slis_t_fieldcat_alv.
MOVE itfdcat[] TO ltfdcat[].
LOOP AT itdata ?dataentabelle
assigning <itdata>.
LOOP AT ltfdcat
assigning <ltfdcat>.
ASSIGN COMPONENT <ltfdcat>-fieldname
OF STRUCTURE <itdata>
TO <field>.
CHECK NOT <field> IS INITIAL.
DELETE ltfdcat.
ENDLOOP.
IF ltfdcat[] IS INITIAL.
EXIT.
ENDIF.
ENDLOOP.
LOOP AT ltfdcat
assigning <ltfdcat>.
READ TABLE itfdcat
ASSIGNING <itfdcat>
FROM <ltfdcat>.
MOVE c_true TO <itfdcat>-no_out.
ENDLOOP.
Code: Alles auswählen.
loop at catalog into catalog_wa.
case catalog_wa-fieldname.
when 'FELD1'.
...
when 'FELD2'.
...
WHEN others.
continue.
endcase.
modify catalog from catalog_wa.
endloop.