2008 Nov 19 6:08 AM
I need to use a variant on selection, it should have the fuctionality like Get a default variant,Provide F4 help, existence check , save the variant in OOPs ALV .
Similar to REUSE_ALV_VARIANT_DEFAULT_GET
REUSE_ALV_VARIANT_F4
REUSE_ALV_VARIANT_EXISTENCE.
Are there any classes which can do the similar funtionality.
Help me.
Thanks in Advance.
Ravindar.
I need to use a variant on selection, it should have the fuctionality like Get a default variant,Provide F4 help, existence check , save the variant in OOPs ALV .
Similar to REUSE_ALV_VARIANT_DEFAULT_GET
REUSE_ALV_VARIANT_F4
REUSE_ALV_VARIANT_EXISTENCE.
Are there any classes which can do the similar funtionality.
Help me.
Thanks in Advance.
Ravindar.
2008 Nov 19 7:08 AM
Hello Reddy
I do not think that there are special classes around for this purpose (I checked the Where-Used-List for structure DISVARIANT).
However, the corresponding fm's for OO-based ALV list layouts can be found in group SLVC:
LVC_VARIANT_DEFAULT_GET
LVC_VARIANT_EXISTENCE_CHECK
LVC_VARIANT_F4
LVC_VARIANT_SELECTRegards
Uwe
2008 Nov 19 4:02 PM
2008 Nov 20 8:05 PM
If you're using the CL_SALV* classes, class cl_salv_layout has methods to do what you're looking for.
2008 Nov 26 5:38 AM
Hi ,
you can do the following which would enable you to create the variant :
data: h_layout type disvariant,
gs_layout type lvc_s_layo.
gs_layout-sel_mode = 'A'.
h_layout-report = syst-cprog.
h_layout-username = sy-uname.
h_layout-handle = handle.
call method g_alv_grid3->set_table_for_first_display
exporting
is_layout = gs_layout
is_variant = h_layout
i_save = 'U'
changing
it_outtab = itab
it_fieldcatalog = fieldcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
Edited by: Marcelo Ramos on Jan 8, 2009 10:10 AM
2008 Nov 26 5:52 AM
Hi ,
you can do the following which would enable you to create the variant :
data: h_layout type disvariant,
gs_layout type lvc_s_layo.
gs_layout-sel_mode = 'A'.
h_layout-report = syst-cprog.
h_layout-username = sy-uname.
h_layout-handle = handle.
call method g_alv_grid3->set_table_for_first_display
exporting
is_layout = gs_layout
is_variant = h_layout
i_save = 'U'
changing
it_outtab = itab
it_fieldcatalog = fieldcat
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
others = 4.
on the ALV grid toolbar you can see the layout button. you can use that to default any particular layouts.
Edited by: Marcelo Ramos on Jan 8, 2009 10:11 AM
2009 Jan 08 10:36 AM
2021 Jun 04 3:43 PM
This is an almost ancient thread at this point, but if Google brought anyone here like it did for me, I was able to use ABAP Objects for the F4 help. To make life easier, there is a static method of class cl_salv_layout_service called f4_layouts.
Usage is like below, call this for ON VALUE-REQUEST of your variant (p_layout in below case).
DATA: gs_layout TYPE slis_vari.
PARAMETERS: p_layout TYPE disvariant-variant.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
PERFORM f4_layouts USING p_layout.
FORM f4_layouts USING p_layout TYPE disvariant-variant.
DATA: ls_layout TYPE salv_s_layout_info,
ls_key TYPE salv_s_layout_key.
ls_key-report = sy-repid.
ls_layout = cl_salv_layout_service=>f4_layouts(
s_key = ls_key
restrict = if_salv_c_layout=>restrict_none ).
p_layout = ls_layout-layout.
gs_layout = ls_layout-layout.
ENDFORM.
2022 Jan 18 4:44 PM