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

ALV layout

Former Member
0 Likes
456

Hi,

I am displaying 2alvs on single page using Obect oriented ABAP. Both the ALVs have different tables to display. now if i save one display layout for first ALV, it is displaying the same in second too.

I want to give two parameter on selection screen.

Layout1----for 1st alv

Layout2----for 2nd alv

is there any way to get layouts list ALV specific rather then program specific.

I want F4 help for layout1 should show only the layouts saved for 1st ALV & F4 for layout2 should show layout saved for 2nd alv.

Thanks much.

2 REPLIES 2
Read only

Former Member
0 Likes
407

Hi Srikanth,

You can have the layout on the selection screen.

What you can do is print the first layout and save the layout with the name.

Then print the ALV for the second internal table and save it's layout.

then you can get both the layouts on the screen by using the following code below.

Though this might not solve your problem totally, this might lead you to a nearer solution.


PARAMETERS:     p_var      TYPE disvariant-variant,
      	    gs_variant TYPE disvariant.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
  PERFORM get_alv_variant
          USING    if_salv_c_layout=>restrict_none
          CHANGING p_var
                   gs_variant.


FORM get_alv_variant
  USING    i_restrict    TYPE salv_de_layout_restriction
  CHANGING cv_layout     TYPE disvariant-variant
           cs_variant    TYPE disvariant.

  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 = i_restrict ).

  cv_layout = ls_layout-layout.
  MOVE-CORRESPONDING ls_layout TO cs_variant.

ENDFORM.                    

Regards,

Kiran

Read only

Former Member
0 Likes
407

Hey!

Try this,

if you are using the class CL_GUI_ALV_GRID

in method SET_TABLE_FOR_FIRST_DISPLAY

parameter IS_VARIANT-report here should put different names if you have more than one alv in the same screen. something like IS_VARIANT-report = 'zreport1' for the first ALV and IS_VARIANT-report = 'zreport2' for the alv 2

good luck!