Code: Alles auswählen.
CLEAR i_fieldcat. REFRESH i_fieldcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'MARA'
CHANGING
ct_fieldcat = i_fieldcat[].
READ TABLE i_fieldcat WITH KEY fieldname = 'MATNR'
TRANSPORTING NO FIELDS.
CLEAR i_fieldcat.
i_fieldcat-fieldname = 'MAKTX' .
i_fieldcat-tabname = '1' .
i_fieldcat-col_pos = sy-tabix . "Hinter MATNR
i_fieldcat-ref_table = 'MAKT' .
i_fieldcat-ref_field = 'MAKTX' .
APPEND i_fieldcat .
Code: Alles auswählen.
TYPES: BEGIN OF lin_output.
INCLUDE TYPE bseg.
TYPES: budat TYPE bkpf-budat,
monat TYPE bkpf-monat,
END OF lin_output.
DATA: it_output TYPE TABLE OF lin_output.
DATA: it_fieldcat_lvc TYPE lvc_t_fcat,
wa_fieldcat_lvc TYPE lvc_s_fcat,
Code: Alles auswählen.
* Feldkatalog aufbauen
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'BSEG'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
CHANGING
ct_fieldcat = it_fieldcat_lvc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Feld hinzufügen
CLEAR wa_fieldcat_lvc.
wa_fieldcat_lvc-fieldname = 'BUDAT'.
wa_fieldcat_lvc-ref_table = 'BKPF'.
APPEND wa_fieldcat_lvc TO g_it_fieldcat_lvc.
CLEAR wa_fieldcat_lvc.
wa_fieldcat_lvc-fieldname = 'MONAT'.
wa_fieldcat_lvc-ref_table = 'BKPF'.
APPEND wa_fieldcat_lvc TO g_it_fieldcat_lvc.