2009 Dec 14 9:15 AM
Hi,
I have a requirement to have a parameter in the selection screen of the report where the users can choose the saved alv layouts. I require the list of layouts to be displayed when the f4 help is clicked or the choose layout popup to get displayed.
Please let me know what function module to use.
Thanks,
Harini
2009 Dec 14 9:20 AM
FM: REUSE_ALV_VARIANT_F4 & how to implement check BCALV_TEST_GRID.
Further details on SDN.
BR,
Suhas
2009 Dec 14 9:18 AM
Hi Harini!
Please use
call function 'HR_F4_FOR_ALV_VARIANT'
exporting
current_report = o_repid
importing
variant = variant.
Kind regards
Peter
2009 Dec 14 9:20 AM
FM: REUSE_ALV_VARIANT_F4 & how to implement check BCALV_TEST_GRID.
Further details on SDN.
BR,
Suhas
2009 Dec 14 9:23 AM
To show default layouse set in the selection scree put the below code in the INITIALIZATION event.
PARAMETERS p_vari LIKE disvariant-variant.
----
INITIALIZATION.
*/Get the default variant
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = gs_alv_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = gs_alv_variant-variant.
ENDIF.
----
AT SLECTION-SCREEN ON <your selection screen field name> VALUE REQUEST.
gs_alv_variant-report = gf_alv_repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_alv_variant
i_save = 'A'
IMPORTING
es_variant = gs_alv_variant
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.
p_vari = gs_alv_variant-variant.
ENDIF.
2009 Dec 14 9:26 AM
Hi,
What is the use of showing the default layout in the selection screen? The default layout will be used if you don't specify a layout in the selection screen. No need to write code to get it.
/Christoffer
2009 Dec 14 9:23 AM
PARAMETERS: p_layout TYPE slis_vari.
DATA: g_alv_table TYPE REF TO cl_salv_table.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
PERFORM select_layout.
FORM select_layout.
DATA: ls_layout_key TYPE salv_s_layout_key,
ls_layout_info TYPE salv_s_layout_info.
ls_layout_key-report = sy-repid.
ls_layout_info = cl_salv_layout_service=>f4_layouts( ls_layout_key ).
p_layout = ls_layout_info-layout.
ENDFORM. "select_layout
FORM display_data.
...
DATA: l_layout TYPE REF TO cl_salv_layout,
ls_layout_key TYPE salv_s_layout_key.
l_layout = g_alv_table->get_layout( ).
ls_layout_key-report = sy-repid.
l_layout->set_key( ls_layout_key ).
l_layout->set_save_restriction( ).
l_layout->set_initial_layout( p_layout ).
...
ENDFORM. "display_data
/Christoffer
2009 Dec 14 9:25 AM