Rapora LAYOUT Varyantı Eklenmesi
Ön ayarlı varyantın belirlenmesi, F4 yardımı ile varyantların listelenmesi, ALV`nin seçilen varyanta göre listelenmesi.
SELECTION-SCREEN BEGIN OF BLOCK blk3 WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS: p_varia FOR disvariant-variant.
SELECTION-SCREEN END OF BLOCK blk3.
INITIALIZATION.
go_main = lcl_main=>get_instance( ).
go_main->initialization( ).
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varia.
go_main->selection_screen_value( ).
METHOD initialization.
me->get_default_variant( ).
ENDMETHOD.
ENDMETHOD.
METHOD selection_screen_value.
me->f4_variant( ).
ENDMETHOD.
METHOD get_default_variant.
DATA: ls_variant TYPE disvariant.
"ls_variant-username = sy-uname.
ls_variant-report = sy-repid.
CALL FUNCTION `LVC_VARIANT_DEFAULT_GET`
EXPORTING
i_save = `A`
CHANGING
cs_variant = ls_variant
EXCEPTIONS
wrong_input = 1
not_found = 2
program_error = 3
OTHERS = 4.
IF sy-subrc = 0.
p_varia = ls_variant-variant.
ENDIF.
ENDMETHOD.
METHOD f4_variant.
DATA: ls_variant TYPE disvariant.
ls_variant-report = sy-repid.
CALL FUNCTION `LVC_VARIANT_F4`
EXPORTING
is_variant = ls_variant
i_save = `A`
IMPORTING
es_variant = ls_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
p_varia = ls_variant-variant.
ENDIF.
ENDMETHOD.
CALL METHOD me->mo_grid_100->set_table_for_first_display
EXPORTING
is_variant = VALUE #( report = sy-repid username = sy-uname variant = p_varia )
i_save = `A`
is_layout = me->ms_layout_100
CHANGING
it_outtab = me->mt_100_itab
it_fieldcatalog = me->mt_fieldcat_100
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.