Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Variant on Selection screen for Oops ALV

Former Member
0 Likes
3,637

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.

8 REPLIES 8
Read only

uwe_schieferstein
Active Contributor
0 Likes
2,060

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_SELECT

Regards

Uwe

Read only

Former Member
0 Likes
2,060

Try this :

It has lots of info about ALV.

Regards

Neha

Read only

bryan_cain
Contributor
0 Likes
2,060

If you're using the CL_SALV* classes, class cl_salv_layout has methods to do what you're looking for.

Read only

Former Member
0 Likes
2,060

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

Read only

Former Member
0 Likes
2,060

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

Read only

Former Member
0 Likes
2,060

Thanks for the posts

Read only

dustinkredmond
Explorer
2,060

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.
Read only

0 Likes
2,060

Thanks Dustin, ancient or not, this was very helpful!