ALV DISPLAY-choose layout button

Hi,
i have an alv report which displays 10 fields from an internal table, now i need to add the choose layout which must include 5 fields other than the existing 10 fields and display the report, with what has been chosen.how can i do this?

In addtion to Rav's reply u have to do the follwoing so taht u can save the layput
The following is where a user can enter a display variant
the no display can be used if the grid output is not to
be controlled by the users variant.
PARAMETERS p_layout LIKE disvariant-variant.
DATA:     gd_layout    type slis_layout_alv.
  w_layout-grid_title = sy-title.
  w_layout-zebra      = 'X'
  w_layout-sel_mode   = 'B'.
  w_layout-cwidth_opt = 'X'
  w_variant-handle    = p_layout.
  w_variant-report    = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
            i_callback_user_command = 'USER_COMMAND'
*            i_grid_title           = outtext
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
*            it_special_groups       = gd_tabgroup
            it_events               = gt_events 
            is_print                = gd_prntparams 
            i_save                  = 'X'
            is_variant = w_variant
      tables
            t_outtab                = it_ekko
       exceptions
            program_error           = 1
            others                  = 2.
  if sy-subrc <> 0.

Similar Messages

  • Choose Layout button in ALV standard

    Hi abap expert,
    Is there any way to display a drop down list button for 'Choose Layout' which include the options (choose layout, change layout, save layout, manage layout) in just 1 button, instead of having the 'choose layout/change layout/save layout' in 3 different separated buttons. Is there any other FM besides 'REUSE_ALV_list_DISPLAY' I could use in order to display 1 combination button of 'Change Layout' while displaying the ALV report.
    Look forward to hear your advice. Thanks in adv.
    Rgds,
    fnr

    Hi Sharin,
    Thanks for fast feedback.
    I'd tried to use the IS_VARIANT parameter as well by passing the gs_layout (type disvariant). In gs_layout, I'd assign sy-repid in the gs_layout-report. But the 3 button of layout still come out in separated buttons, is it because I'm using the FM 'REUSE_ALV_LIST_DISPLAY'? Is there any other standard FM I could use which have GUI Status with 1 combination 'Choose Layout' button?
    Thanks.
    Cheers,
    fnr

  • ALV List Missing Status Menu (Sorting, choose layout etc)

    Hi,
    I developed a report with ALV List display. When I display the ALV List, why my status menu (normally contains sorting, export to local, choose layout and other buttons) that will appear on top of the ALV report is missing?
    I try to look for the ALV Function Module parameters, but seems non of it related.
    I developed my previous report, it do have the menu there. Just this new report is missing.
    Can someone tell me where to set or code?
    Thanks.

    Hi Irene,
    Please check your pf_status_set routine if you use FM REUSE_ALV_GRID_DISPLAY.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'PF_STATUS_SET'
          i_callback_user_command  = user_command
          i_buffer_active          = space
          i_bypassing_buffer       = 'X'
          is_layout                = er_layout
          it_fieldcat              = er_fieldcat[]
          it_special_groups        = er_sp_group
          i_save                   = 'A'
          is_variant               = e_variant
          it_events                = er_events[]
        TABLES
          t_outtab                 = outtab.
    *  FORM pf_status_set
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      DATA: rt_extabw TYPE slis_extab.
      SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
      SET TITLEBAR 'STANDARD'.
    ENDFORM.                    "pf_status_set

  • How to add Change Layout Button to ALV Toolbar?

    Hi All,
    I am using a SAP GUI STATUS 'STANDARD' that has almost all the funcationality needed except for the change layout button.
    I have tried changing the GUI STATUS to 'STANDARD_FULLSCREEN' which has the button I am looking for but it does not show up.
    What am I missing to have the 'Change Layout' Button show on the toolbar?
    thank you

    I am using Classes.
    I did not specify any type of table of 'exclude' buttons.
    here is my code that display the ALV
    DATA gr_alv TYPE REF TO cl_salv_table.
    DATA gr_functions TYPE REF TO cl_salv_functions_list.
    DATA gr_selections TYPE REF TO cl_salv_selections.
    DATA gr_events TYPE REF TO cl_salv_events_table.
    DATA gr_settings TYPE REF TO cl_salv_display_settings.
    DATA gr_layout TYPE REF TO cl_salv_layout.
      TRY.
          cl_salv_table=>factory(
           IMPORTING r_salv_table = gr_alv
           CHANGING  t_table      = gt_rpt_details ).
          PERFORM f_display_settings.
          gr_alv->set_screen_status(
          "pfstatus = 'Z_STANDARD'
          pfstatus = 'ZSTANDARD_FULLSCREEN'
          report = sy-repid
          "i_save = 'A'
          set_functions = gr_alv->c_functions_all ).
          gr_events = gr_alv->get_event( ).
          "create layout object
          CREATE OBJECT gr_layout.
          gr_layout->get_current_layout( ).
          CREATE OBJECT event_handler.
          SET HANDLER event_handler->on_user_command FOR gr_events.
          gr_functions = gr_alv->get_functions( ).
          gr_functions->set_all('X').
          gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).
    *       Set print preview
          gr_functions->set_print_preview( ).
          gr_alv->get_display_settings( ).
          gr_alv->display( ).

  • Hide 'Change Layout' button from alv toolbar

    Hello All,
    can anyone let me know how can we hide the change layout button or exclude the change layout button from the ALV tool bar using OOPS . what's the fcode for it.
    Thank You !
    Ravi

    Hi Ravi,
    Please refer to this [Program|http://www.saptechies.com/disable-some-standard-buttons-from-alv-display/].
    Hope this helps.
    Regards,
    Chandravadan

  • Change layout Button In ALV Grid

    Hi all,
    I have a requirement where I am creating Field Catalogue from Z Table(has 60 fields) for few(12) fields.
    The user would like to have the option to add more fields by changing the Layout. But I dont see the Fields in Hidden Column when I click the Change Layout Button in ALV Toolbar. It just displays the Field based on Field Catalogue defined.
    Is there a way I can maintain all the fields without being displayed in ALV initally and letting the user select the hidden fields as per their requirement. As happens in SE16 where we can select the fields to be displayed.
    Thanks for the support.

    Hi Abhilasha,
    In the reuse_alv function module we can see a field I_SAVE.If you pass this as 'X' then the option of saving the layout variants are available.
    Create a layout by,selecting just the fileds required for display and set it as the default variant.It can be made Global or user-specific.But  we need to declare all fields in the fieldcatalog.
    So if the default variant is set,everytime the program is run it shows only the fields selected in it but can select more form the change layout option.
    Hope it helps.
    Regards
    Byju

  • Save layout Button in Object Oriented ALV

    Hi  gurus,
    I am working on Object Oriented ALV. I am facing one problem when the outpput get shown on the screen the save layout and select layout buttons are not appearing on the application toolbar of alv.
    TRY .
          cl_salv_table=>factory( IMPORTING r_salv_table = g_alv_out
                                   CHANGING t_table      = i_alv ).
        Set status GUI
          g_alv_out->set_screen_status(
              pfstatus      = 'STANDARD'
              report        = sy-repid
              set_functions = g_alv_out->C_FUNCTIONS_ALL ).
           g_columns = g_alv_out->get_columns( ).
        Set new description texts for columns
          PERFORM f_set_column_name USING:
                'LTEXT' text-001 text-001 text-001 space,
                'NAME1' text-002 text-002 text-002 space,
                'TXZ01' text-003 text-007 text-007 space,
                'KWERT' text-004 text-004 text-004 space,
                'WEMNG' text-005 text-010 text-011 space,
                'BALNC' text-012 text-013 text-014 space,
                'AFNAM' text-006 text-008 text-009 space.
          PERFORM f_set_column_name USING 'WEMNG'
                  space space space 'WAERS'.
          PERFORM f_set_column_name USING 'KWERT'
                  space space space 'WAERS'.
        Set column as hotspot
          g_column ?= g_columns->get_column( 'EBELN' ).
          g_column->set_cell_type( g_column->hotspot ).
          g_events = g_alv_out->get_event( ).
          CREATE OBJECT gr_events .
          SET HANDLER gr_events->on_double_click FOR g_events.
        Display report
          g_alv_out->display( ).
        CATCH cx_salv_msg.
      ENDTRY.
    where in the Status  STANDARD I have entered all the buttons includeing these two buttons
    Can you please Help me in solving this issue.
    thanks,
    Vinod.
    Edited by: vinod parhad on Jul 2, 2010 1:35 PM

    data: gr_layout  type ref to cl_salv_layout,
    gr_alv     type ref to cl_salv_table,
    gs_key     type salv_s_layout_key,
    * in your SALV routine.... after FACTORY call
    gs_key-report = sy-repid.
    * User can save layout.
      gr_layout  = gr_alv->get_layout( ). "layouts
      gr_layout->set_key( gs_key ).  "Pass Program Name
      gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ). "User can save
    See also Rich Heilman's excellent tutorials on SALV by searching for SALV Tutorial,
    See also programs named: SALV* for demonstrations of SALV outputs and how to code.
    Edited by: BreakPoint on Jul 2, 2010 1:46 PM add references for tutorials

  • Hide Change Layout Button in ALV report o/p for MB52 Tcode

    Hi,
    Is it possible to Hide Change Layout Button in ALV output for Report MB52 using authoriztaion.
    We have created a layout in which we are hiding some coloumns which the user should not see.
    But if the change layout button is active then the user can add those coloumns to output.
    Is this possible through authorizations. I want to avoid doing any chnages to the std sap program.
    Thanks & Regards,
    Fawaz

    Check the object S_ALV_LAYO

  • 'Save layout' button missing in the ALV report layout screen

    Hi Friends,
         In one of our ALV report the 'save layout' button is missing in the report output screen.i have used the OO concept for creating the ALV output and not the function module.I have attached the code below used for creating the ALV grid.
    CREATE OBJECT alv_grid
          EXPORTING i_parent = g_container_2.
    CALL METHOD alv_grid->set_table_for_first_display
         exporting
                   i_structure_name = 'PA0002'
                   is_layout =
           CHANGING
                     it_outtab = gt_outtab
                     it_fieldcatalog = wa_fieldcat.
    But i'm not able to trace why the 'save layout' button is missing in the output.Can anyone of you help me in sorting out this problem.
    Thanks and Regards,
    Vadivel.

    Pass <u><i><b>A to I_SAVE</b></i></u> parameter. That will give the options to the user to save the layout outs.
    I_SAVE = SPACE
    Layouts cannot be saved.
    I_SAVE = 'U'
    Only user-defined layouts can be saved.
    I_SAVE = 'X'
    Only global layouts can be saved.
    I_SAVE = 'A'
    Both user-defined and global layouts can be saved.
    Regards,
    Ravi
    Note : Please mark all the helpful answers
    Message was edited by: Ravikumar Allampallam

  • ALV grid display enable save button

    Hi gurus all,
    I want to make save button in alv display turns onn, cause now it's gray and i cannot click on it. and i'm using function reuse_alv_grid_display.
    i'm included half of my code,
      DATA: li_events  TYPE slis_t_event,
            lwa_events LIKE LINE OF li_events.
      REFRESH li_events.
      CLEAR lwa_events.
    Get event
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 4
        IMPORTING
          et_events   = li_events.
    Set event END_OF_LIST
      READ TABLE li_events WITH KEY name = 'END_OF_LIST'
      INTO lwa_events.
      IF sy-subrc = 0.
        lwa_events-form = 'END_OF_LIST'.
        MODIFY li_events FROM lwa_events TRANSPORTING form
        WHERE name = 'END_OF_LIST'.
      ENDIF.
      data : ls_variant like disvariant,
             gs_layout  type slis_layout_alv.
      ls_variant-report = sy-repid.
    Display ALV
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = sy-repid
          i_callback_top_of_page = 'TOP_OF_PAGE'
          it_fieldcat            = i_fieldcat
          is_layout              = gs_layout
          it_sort                = i_sortcat
          it_events              = li_events
          i_save                 = c_x
          is_variant             = ls_variant
        TABLES
          t_outtab               = i_final
        EXCEPTIONS
          program_error          = 1
          OTHERS                 = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid
                TYPE sy-msgty
                NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

    Hi memeo,
    1. Simple
    2.<b>  i_save                  = 'A'</b>
    3. While calling the fm
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    make sure u pass the parameter also. (with value 'A')
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          <b>      i_save                  = 'A'</b>
    regards,
    amit m.

  • How to add Change Layout, savelayout, select layout Button to ALV Toolba

    How to add Change Layout, savelayout, select layout Button to ALV Toolbar?
    Moderator message: please (re)search yourself before asking.
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]
    locked by: Thomas Zloch on Sep 10, 2010 10:57 AM

    Variant
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant          = gs_variant
                i_save              = c_save
              it_default_fieldcat =
           IMPORTING
                e_exit              = gf_exit
                es_variant          = gs_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.
        IF gf_exit = space.
          cf_varia = gs_variant-variant.
        ENDIF.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save        = c_save
        CHANGING
          cs_variant    = gs_variant
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc NE 0.
        cf_subrc = sy-subrc.
      ENDIF.
    Change Layout, savelayout, select layout Button  pass the value which is in BOLD
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                =  gd_repid
         i_callback_user_command           =  'U_COMMAND'
         i_callback_top_of_page            = 'TOP-OF-PAGE'
                         is_layout                    =  fld_lay
           it_fieldcat                  =  fieldcatalog[]
                       IT_EXCLUDING                  =
                       IT_SPECIAL_GROUPS             =
                       IT_SORT                        =  it_sort[]
         i_default                      = 'X'
         i_save                         = 'A'
         is_variant                     = gs_variant
         it_events                      =  it_event[]
        TABLES
          t_outtab                      =    it_sales
                     EXCEPTIONS
                       PROGRAM_ERROR                     = 1
                       OTHERS                            = 2
    Annasaheb

  • Saving layout in ALV display

    Hi,
    I am using both is_variant, i_save parameters in this method, but still am not getting save layout button on my grid.
    ls_variant-REPORT = sy-repid.
      CALL METHOD w_alv1->set_table_for_first_display
        EXPORTING
          is_variant                    = ls_variant
          i_save                        = 'A'
          i_default                     = 'X'
          is_layout                     = it_layout
        CHANGING
          it_outtab                     = <fs1>
          it_fieldcatalog               = it_fcat
          it_sort                       = it_sort
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    Please sujjest me.
    Thanks,
    Prathap

    sample code:
    gs_variant-report = g_repid.        "Program name
    CALL METHOD grid1->set_table_for_first_display         
         EXPORTING it_toolbar_excluding = gt_ui_functions  
                   is_print             = gs_print         
                   is_layout            = gs_layout        
                   i_save               = x_save           
                   is_variant           = gs_variant       
         CHANGING  it_outtab            = gt_deldef        
                   it_fieldcatalog      = pt_fieldcat.     
    Also c
    heck if you have authorization to all basic ALV functiobnalities.

  • What is the constant name for Change layout Button in ALV Grid ABAP Objects

    Dear All,
    I have one query please help me.
    what is the constant name for Change layout Button in ALV Grid ABAP Objects.
    With Rgds,
    Babu

    Halo Vinod,
    The consant name is cl_gui_alv_grid=>mc_fc_current_variant.
    Regards
    Arshad

  • How to hide 'layout button' on ALV toolbar

    Hi,
    I have an ALV and it has standard toolbar, now i want to hide 'Layout button' from the toolbar based on specific condition e.g when flag = 1.
    How to do that.
    Thanks,

    If you are using the REUSE function, you can use the "EXCLUDING" parameter, and pass the FCODE for "Change Layout" to this table.  This will remove the icon from the toolbar.  Here is an example.
    REPORT rich_0001 .
    * Global ALV Data Declarations
    TYPE-POOLS: slis.
    * Internal Tables
    DATA: BEGIN OF ialv OCCURS 0,
          test1(10) TYPE c,
          test2(10) TYPE c,
          END OF ialv.
    DATA: xfc TYPE slis_fieldcat_alv.
    DATA: ifc  TYPE slis_t_fieldcat_alv.
    DATA: iexcluding TYPE  slis_t_extab.
    DATA: xexcluding LIKE LINE OF iexcluding.
    PARAMETERS: p_hide TYPE c DEFAULT 'X'.
    START-OF-SELECTION.
      REFRESH iexcluding.
    * If the user wants to hide the change layout icon, then add to IEXCUDING
      IF p_hide = 'X'.
        xexcluding-fcode = '&OL0'.
        APPEND xexcluding TO iexcluding.
      ENDIF.
      REFRESH ifc.
      xfc-reptext_ddic = 'Test1'.
      xfc-fieldname    = 'TEST1'.
      xfc-outputlen    = '10'.
      APPEND xfc TO ifc.
      xfc-reptext_ddic = 'Test2'.
      xfc-fieldname    = 'TEST2'.
      xfc-outputlen    = '10'.
      APPEND xfc TO ifc.
    * Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_excluding = iexcluding
          it_fieldcat  = ifc
        TABLES
          t_outtab     = ialv.
    Regards,
    Rich Heilman

  • Default Layout for Multiple ALV displays

    Hello All,
    I have a requirement where I am displaying multiple ALV grid displays on different tabs of a screen.
    Now I have to set a default layout for each of the grids separately as they have different fields.
    Please let me know how to do it, I am using OO ALV display.
    Thanks a lot
    Ruchi

    Hi,
    According to your grid called pass the variant name
        gs_variant-report       = sy-repid.
        gs_variant-username     = sy-uname.
        gs_variant-variant      = v_vari.   " Your variant Name
        call method grid1->set_table_for_first_display 
          exporting
            is_layout                     = gs_layout
            is_variant                    = gs_variant  "<<<<<<<<<
            i_save                        = 'A'
            it_toolbar_excluding          = i_exclude[]
          changing
            it_outtab                     = i_output[]
            it_fieldcatalog               = i_fieldcat[]
          exceptions
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            others                        = 4.

Maybe you are looking for