ALV Change layout before Content is displayed

Hello expert,
How can i call default button "change layout" before the alv content?. i want that when the alv appear, the initial screen is like below, where user can choose which column he want to be displayed.
any help please?

Hi Hassim,
Miantain in the Reuse Alv Grid display Layout as Save options below
   i_save                           = 'A'
Example :
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                = sy-repid
       i_callback_top_of_page            = 'TOP_OF_PAGE'
       is_layout                         = layout_h
       i_callback_user_command           = 'USER_COMMAND'
       it_fieldcat                       = it_fieldcat
        i_save                           = 'A'
     TABLES
       t_outtab                          = it_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.

Similar Messages

  • ALV change layout button in toolbar

    Hi,
    I have an ALV,which has a change layout option in its toolbar.I want to save layouts which r user specific.Please help me with this isse.
    Thanks

    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.
      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.
    Reward if this helps.

  • How to change layout for list display in background

    Hi All,
    I want to change layout for the list display of tcode fbl1n when i execute in background. is there anyway to select our own layout when i execute in background. When i execute in foreground we can change the layout by selecting change layout button, but how it possible when in backgroung, is there any way please let me know.
    Thanks in advance.
    Regards,
    Vishal

    Hi,
      Create a list variant by executing the program and changing the layout and saving..
      Then use the "Layout" parameter in the selection screen and give the variant you created earlier...
      Then while executing in background the list variant will be pickedup accordingly (given in the selection screen)..
    Hope this helps...
    THanks,
    Naren
    Message was edited by: Narendran Muthukumaran

  • Probelm in change layout

    I have created one query zmaterial. When i display ALV output it is displaying corectly. but when i got to change layout, in the description of the change layout some text is displaying in english and some in spanish.. please let me know the problem?
    Regadrs,
    zub

    Hi,
    please check the links and create a) a useful subject and b) a useful question, thank you.
    [FAQ's, intros and memorable discussions in the ABAP General Forum|FAQ's, intros and memorable discussions in the ABAP General Forum;
    [How to post code in SCN, and some things NOT to do...|How to post code in SCN, and some things NOT to do...;
    [Please read "The Forum Rules of Engagement" before posting! HOT NEWS!! |Please read "The Forum Rules of Engagement" before posting!  HOT NEWS!!;
    Regards
    Clemens

  • How to Insert Fields in ColumnSet of Change Layout Buttonof ALVgrid Output?

    Hi Guys,
                Can anybody tell me how to insert columns in Column Set of Change Layout Button.My Reuireemnt is i Have to display the Basic Layout and have to provide the other fields in the "Columnset" in Change Layout which will be displayed when u clcik the Change Layout button in the ALV Grid Output screen. so that user can select based on their usage.
              Please Very Urgent.
    Thanks,
    Gopi.

    You can try this ... which field you dont want to show in the fieldcatalog you can use
    fieldcat-fieldname = 'F1'.
    fieldcat-no_out  = 'X'
    ( suppose F1 field you dont want to show).
    But it will appear when user click on the change layout button.
    regards
    shiba prasad dutta

  • In ALV- Save layout is not holding sorting values..

    hello expert.
    in ALV-> Change Layout -> filter Material -> 89* and save as default.
    but not working when i execute the 2nd time from starting onwards..!
    my alv is able to save screen but not filtering values .
    my alv unable to hold filter value as default setting.
    could you please help me out.
    thank you,
    with best regards
    srinivas rathod

    Hi
    Save personalization is for saving variables not for saving layout. If you are doing any changes to layout you can directly save by clicking save button.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/6f6b52f5981c91e10000000a11466f/frameset.htm
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/01/42c73c13b0ce5be10000000a114084/frameset.htm
    Regards
    Ravi
    Edited by: Ravi Naalla on Apr 3, 2009 3:47 AM
    Edited by: Ravi Naalla on Apr 3, 2009 3:49 AM

  • Changing layout of ALV to excel and displaying the data there

    Dear All,
    My requirement is that I have to develop an ALV report, and also plot the graphs for the same.
    I need different types of graphs, so I have searched on SDN, and I found out a blg:-
    "Report with a Graph.. An Approach!"
    Here is what the person has done:-
    I developed a simple ABAP report using ALV and just dumped all my data on it.
    After this I downloaded the Standard Excel template available in the ALV.
    Defined my own worksheets in this template, wrote some macros to pick up the data from the “RawHeader” sheet, which is available by default and will contain the ALV data.
    I inserted 1 chart in this Excel template. In this chart I used the same chart type as was being used by the user for his graph. Just right clicked on the Graph area and made the changes in the source data and made it point to the sheet containing the final data.
    That’s it my job is almost done.
    After this uploaded this template back into the report output through
    the layout settings->Change Layout Tab.
    Save it as a variant and made it a default. (Do not default it if you have more than 1 user and more than 1 template…. Select the appropriate variant for the appropriate user and then display)
    Well, this also was not that easy as I had thought. I landed up into 1 trouble.
    In my report the number of columns displayed was not constant and kept changing based on the input. This fact was taken care by designing a variable field catalogue. But now I had gone past the simple ALV display and was giving the output in an Excel sheet using a pre-defined template. Well, I immediately found a solution to this with the set_frontend_fieldcatalogue method of CL_GUI_ALV_GRID class and fixed the field catalogue every time after calling the set_table_for_first_display method. This solved most of my problems, which were not many though.
    Now here are my issues:-
    I have developed the ALV report, and I have also changed the layout to excel.
    But, I am unable to get the ALV Report data in the RawHeader Sheet, which is available by default.
    Could anyone please guide me through this method??
    It is urgent.
    Points are assured for helpful answers.
    Thanks and regards,
    Prerna

    Hi Satya Priya,
    Do I have to create my own template, or the Standard ones available will do?
    HEre is what I do:-
    Once I get my ALV output, I goto Change LAyout->View tab.->Prefered view->Microsoft Excel.
    Here I get a list of available excel templates There are 2:-
    sap_mm.xls, and sap_om.xls
    I select one of these, and the excel spreadsheet is displayed on the ALV screen.
    But the re is another button, "Upload Document to BDS".
    Do I have to upload one of the above templated to BDS?
    And please tell me in detail, what is BDS???
    Thanks for your help, and waiting for reply,
    Prerna

  • Display Subtotals on ALV Report W/O changing Layout

    Hi ,
    I need to display subtotals of quantity fields in my output of report ,with corresponding production order by using ALV container,Layout default seetings won't work here because user has to do many operations such as sorting filtering etc ,after displaying the report

    Check these threads out
    http://www.sap-basis-abap.com/sapalv.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    DATA SORTING AND SUBTOTAL
    DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD1'.
    GS_SORT-SPOS = 1.
    GS_SORT-UP = 'X'.
    GS_SORT-SUBTOT = 'X'.
    APPEND GS_SORT TO GT_SORT.
    CLEAR GS_SORT.
    GS_SORT-FIELDNAME = 'FIELD2'.
    GS_SORT-SPOS = 2.
    GS_SORT-UP = 'X'.
    *GS_SORT-SUBTOT = 'X'.
    APPEND GS_SORT TO GT_SORT.
    Regards

  • The Visible attribute on alv grid column is not changed after Change Layout

    Setup:
    I have a program that displays output in an ALV grid (using cl_salv_table).
    The ALV grid is displayed within a custom control on a subscreen.
    I have 4 subscreens being used on a tabstrip control.  So I have 4 ALV grids total (one on each subscreen).
    On each ALV grid, I have set the set_layout_change function to true so that the user can hide and unhide columns etc. on each grid via the button on the alv grid toolbar.
    I also allow the user to dowload the contents of all 4 grids to excel.  To do this I have a custom button that when clicked goes to each ALV grid - gets the column metadata (via cl_salv_columns_table-get() ) and checks the visibility to determine if the column should be downloaded or not (via cl_salv_column-is_visible() ) to excel.
    The Problem:
    As I said I have 4 grids being displayed via a tab control.  Let's say the user is on tab 1 and unhides some columns on the alv grid 1 via the Change Layout... button.  And then the user navigates to tab 2.  If they click the download button at that point - when the download code is run and it checks the visibility of the columns on alv grid 1 - the changes that were made via the Change Layout... button have not synchronized yet.  When I call is_visible() for a column that was unhid it still comes back as false. 
    The only way I have found to remedy this is to make the user click on a button on the alv grid's toolbar before navigating to a different tab to force the synchronization between the changes made and the backend column metadata.  However, this is not the best option and requires training for the user that they have to do this for the download to work correctly. 
    The Question:
    1) why is the Change Layout... button not automatically synchronizing the changes it made to the back end?  Is there a way to make it do this?
    2) OR, is there a way that I can force the synchronization within the code and not force the user to click a button on the alv grid?  If there is a way to force the synchronization - where do I put that code?  As far as I can tell, when I switch between tabs - I am unable to catch that action in my PAI events.
    Thanks in advance for any help.

    I was able to resolve this issue with a satisfactory solution.
    In my program I had a local class definition to handle the grids' events.  When the synchronization wasn't working I only had two events defined: for link_click and added_functions. 
    I created another definition for event after_salv_function:
                   on_after_salv_function for event after_salv_function of cl_salv_events importing e_salv_function
    There is no code in the method implementation - but adding this event handler now causes a synchronization to occur after the Change Layout is done.

  • 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

  • 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( ).

  • Save Changed layout of ALV

    Hello All,
    I am using the class 'cl_salv_table' to create an ALV. In the application toolbar I have the option to change the layout displayed in tha ALV but I am not able to save my changed layout. Please suggest how do I enable the save layout button in the toolbar.
    Thanks,
    Anju

    This demo example creates a PF status for displaying the buttons, Can  I not get the buttons using the standard functions available with the ALV. I am getting the change layout on its own I am not reqd to create a PF status for it. Can I not enable the button save layout also. Also if I create the PF status I would have to add all the buttons reqd in the ALV in the PF status manually
    thanks,
    Anju

  • Create Change Layout in ALV list report

    Hi,
    i have create my own change layout button at my alv list report, my problem is i don't know what coding can be used to activate the change layout function in my own button. Who have sample programming for this function please share it....
    tq.

    Hi,
    By default if you're using the ALV List Display function module, there's no need for you to code the 'Change Layout' function, the standard function will be there, unless there's something you want and the standard 'Change Layout' function could not provide.
    Go to Abap Editor and look for program with 'BALV*'. You'll get a whole list of DEMO program on ALV.

  • Using Change Layout Tab on ALV to Export to Excel

    Hi Forms!
    I have an ALV grid that I export to excel to allow users to manipulate the data exported further.
    i do this by clicking change layout -> View -> 'Microsoft Excel' -> click on the template you want to use and click the check mark to export.
    My problem is I have a header on the ALV that display's the user selection screen options... all my data shows in excel correctly except that my selection screen header which I would expect in the 'Raw Header' Tab in excel.
    If I export to excel using excel export button the header shows up, however this does not help as we like using the pivot table setup from the change layout option.
    thank you,
    Here is my code for producing the header...
    ATA: lo_header  TYPE REF TO cl_salv_form_layout_grid,
            lo_h_label TYPE REF TO cl_salv_form_label,
            lo_h_flow  TYPE REF TO cl_salv_form_layout_flow,
            lv_i TYPE i,
            lv_mtart LIKE LINE OF s_mtart,
            lv_auart LIKE LINE OF s_auart,
            lv_bkbez LIKE LINE OF s_bkbez,
            lv_lines TYPE i.
    *   header object
      CREATE OBJECT lo_header.
      lo_header->set_column_count( 10 ).
      lo_h_label = lo_header->create_label( row = 1 column = 1 ).
      lo_h_label->set_text( 'Selection Screen Values' ).
    *   information in tabular format
      CONCATENATE 'Dates: ' s_date-low  ' ' ' to ' s_date-high ' ' INTO l_text RESPECTING BLANKS.
      lo_h_flow = lo_header->create_flow( row = 2  column = 1 ).
      lo_h_flow->create_text( text = l_text ).
      CONCATENATE 'Plant: ' p_werks ' ' INTO l_text RESPECTING BLANKS.
      lo_h_flow = lo_header->create_flow( row = 3  column = 1 ).
      lo_h_flow->create_text( text = l_text ).
      CONCATENATE 'Costing Variant: ' p_klvar INTO l_text RESPECTING BLANKS.
      lo_h_flow = lo_header->create_flow( row = 4  column = 1 ).
      lo_h_flow->create_text( text = l_text ).
      CONCATENATE 'Costing Version: ' p_tvers INTO l_text RESPECTING BLANKS.
      lo_h_flow = lo_header->create_flow( row = 5  column = 1 ).
      lo_h_flow->create_text( text = l_text ).
    *there can be 1 or many Material Types need to check
      DESCRIBE TABLE s_mtart LINES lv_i.
      IF lv_i > 1.
        lv_lines = 1.
        CONCATENATE 'Material Type(s): ' s_mtart-low INTO l_text RESPECTING BLANKS.
        lo_h_flow = lo_header->create_flow( row = 6  column = lv_lines ).
        lo_h_flow->create_text( text = l_text ).
        LOOP AT s_mtart INTO lv_mtart .
          IF lv_lines > 1.
            lo_h_flow = lo_header->create_flow( row = 6  column = lv_lines ).
            lo_h_flow->create_text( text = lv_mtart-low ).
          ENDIF.
          lv_lines = lv_lines + 1.
        ENDLOOP.
      ELSE.
        CONCATENATE 'Material Type(s): ' s_mtart-low INTO l_text RESPECTING BLANKS.
        lo_h_flow = lo_header->create_flow( row = 6  column = 1 ).
        lo_h_flow->create_text( text = l_text ).
      ENDIF.
    *   set the top of list using the header for Online.
      cr_content = lo_header.

    Hello Re_flex....thanks again but I am missing a step here as I was able to hide the column by right-clicking but when I click on the layout there is no layout that I can select. Do you know if these layouts are set in config or not as my layout setting displays 'X' user specific or 'A' ALL but when I select these nothing is displays and when I save I get a message back 'No selection'

  • 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

Maybe you are looking for

  • Help on getting value from string

    Hello can someone please help me with my code? I would like to know how to get a value in a string as an integer type This is what I have so far String x = "12345"; for(int f=0; f<5; f++){ int c = stringDigits.charAt(f);      sum += c;               

  • How to put apps in sd card

    ok, so i just got the new blackberry curve 8530 (sprint) and i was wondering how to use most of my sd card instead of my device memory. i think most of my (11) apps are in my phone and want to transfer them to my sd card. can anybody explain this to

  • MBAM 2.5 Reports

    Hi, I recently deployed MBAM 2.5 on Friday and it's all working fine. Tried to check the compliance reports today on Tuesday (Enough time for it to technically update) and they are empty saying no data is available. I had a look around and previous v

  • What code do i need to make my animation works in IE or other browsers other than Firefox?

    Hi, I am working on a website with animation.  It shows on Firefox but not IE.  Can anyone please advise what code I need to add?  Or something else I need to do? Thanks, mykw123

  • HANA Live automatic universe creation

    Please correct me if I'm wrong, but it seems that automatic universe generation is not supported in the current version of the BOBJ platform (BI 4.1, SP1) and HANA Live.  Does anyone know when support for automatic universe generation from the 651 HA