Code: Alles auswählen.
* Variablendeklarationen für ALV Grid
DATA:
fieldcat TYPE slis_t_fieldcat_alv, "Feldkatalog
*Workarea für einzelne Zeilen eines Feldkatalogs. Wird benötigt, falls
*das Feldkatalog um eigene Spalten erweitert werden soll.
wrk_fieldcat_alv LIKE LINE OF fieldcat,
*ALV-Überschrift
sav_listenname TYPE lvc_title,
g_repid LIKE sy-repid,
* Variablen für die Layout-Variante
variante LIKE disvariant,
def_variante LIKE disvariant,
variant_exit(1) TYPE c.
*********************************************************
*************** Selektionsbildschirm ********************
*********************************************************
*Feld für die Variante im Selektionsbildschirm
PARAMETERS: p_vari LIKE disvariant-variant.
* F4-Hilfe für die Anzeigevariante
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
*Initialisierung
g_repid = sy-repid.
CLEAR variante.
variante-report = g_repid.
* Get default variant
def_variante = variante.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = def_variante
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = def_variante-variant.
ENDIF.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = variante
i_save = 'A'
* it_default_fieldcat =
IMPORTING
e_exit = variant_exit
es_variant = def_variante
EXCEPTIONS
not_found = 2.
IF sy-subrc = 2.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
IF variant_exit = space.
p_vari = def_variante-variant.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
VARIANTE-REPORT = SY-REPID.
* Variante einlesen
IF NOT P_VARI IS INITIAL.
MOVE VARIANTE TO DEF_VARIANTE.
MOVE P_VARI TO DEF_VARIANTE-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = 'A'
CHANGING
CS_VARIANT = DEF_VARIANTE.
VARIANTE = DEF_VARIANTE.
ELSE.
CLEAR VARIANTE.
VARIANTE-REPORT = SY-REPID.
ENDIF.
start-of-selection.
********************************************************
* HAUPTPROGRAMM
********************************************************
Code: Alles auswählen.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = fieldcat[]
i_save = 'A'
i_grid_title = sav_listenname
is_variant = variante
TABLES
t_outtab = itab.
Code: Alles auswählen.
parameters: p_layout type slis_vari default '/STANDARD'.
// F4-Auswahl fürs Layout
at selection-screen on value-request for p_layout.
wa_variant-report = sy-repid.
call function 'LVC_VARIANT_F4'
exporting
is_variant = wa_variant
* IT_DEFAULT_FIELDCAT =
i_save = 'A'
importing
e_exit = d_valreq_exit
es_variant = wa_variant
exceptions
not_found = 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.
else.
if d_valreq_exit <> 'X'.
* set name of layout on selection screen
p_layout = wa_variant-variant.
endif.
endif.
// Layout vorbelegen
wa_variant-variant = p_layout.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
// ALV aufrufen
call function 'Z_FVH_ALV_LISTE_AUSGABE'
exporting
i_structure_name = d_structure_name
is_variant = wa_variant
is_layout = wa_layout
tables
t_outtab = it_fusionen_darl
lt_fieldcatalog = it_fcat
.
Ein Z-FuBa? Und was verbirgt sich dahinter?airwaver hat geschrieben:so würde ich es machen ...
[/code]Code: Alles auswählen.
... // ALV aufrufen call function 'Z_FVH_ALV_LISTE_AUSGABE' exporting i_structure_name = d_structure_name is_variant = wa_variant is_layout = wa_layout tables t_outtab = it_fusionen_darl lt_fieldcatalog = it_fcat .