Code: Alles auswählen.
TYPE-POOLS: slis.
* Deklarationen
*ALV_GRID
DATA: lt_fcat TYPE slis_t_fieldcat_alv.
DATA: ls_fcat TYPE slis_fieldcat_alv.
DATA: gs_layout TYPE slis_layout_alv.
PERFORM feldkatalog_fuellen.
PERFORM fieldcatalog_commit.
PERFORM alv_fill.
*PERFORM layout USING gs_layout.
*&---------------------------------------------------------------------*
*& Form feldkatalog_fuellen
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM feldkatalog_fuellen.
CLEAR ls_fcat.
ls_fcat-fieldname = 'POSID'.
ls_fcat-seltext_l = 'PosId'.
APPEND ls_fcat TO lt_fcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'Objnr'.
ls_fcat-seltext_l = 'Objektnummer'.
APPEND ls_fcat TO lt_fcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'PRART'.
ls_fcat-seltext_l = 'Projektart'.
APPEND ls_fcat TO lt_fcat .
CLEAR ls_fcat.
ls_fcat-fieldname = 'Stat'.
ls_fcat-seltext_l = 'Status'.
APPEND ls_fcat TO lt_fcat .
ENDFORM. "feldkatalog_fuellen.
*&---------------------------------------------------------------------*
*& Form alv_fill
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM alv_fill.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_grid_title = 'Ausgabe'
it_fieldcat = lt_fcat
is_layout = gs_layout
i_save = 'A'
TABLES
t_outtab = t_ausg
EXCEPTIONS
programm_error = 1
OTHERS = 2.
ENDFORM. "alv_fill
*& Form fieldcatalog_commit
*&
*&---------------------------------------------------------------------
FORM fieldcatalog_commit.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 't_ausg'
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
programm_error = 1
OTHERS = 2.
ENDFORM. "fieldcatalog_commit
*&---------------------------------------------------------------------*
*& Form layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->LS_LAYOUT text
*----------------------------------------------------------------------*
FORM layout USING ls_layout TYPE slis_layout_alv.
ls_layout-colwidth_optimize = 'X'.
ENDFORM. "layout