Regarding Layout saving in ALV

Hi,
In my requirement,i want to save layout of the ALV Report with data in it.So that i can use this variant and get the same data again.I tried with the code below,but its saving only layout,but not the data.
CALL METHOD grid1->set_table_for_first_display
         EXPORTING i_structure_name = 'ty_fields_final'
                   i_save           =  'A'
                   is_variant       =  g_variant
                   is_layout        = gt_layout
                   it_toolbar_excluding  = lt_exclude
                  I_DEFAULT        =  PDEFAULT
         CHANGING  it_fieldcatalog  = gt_fieldcat_lvc[]
                   it_outtab        = i_fields_final.
And also tried it with function module  'LVC_VARIANT_SAVE'.
Can any one help me in this.
Regards
Shibin

hi,
   Try this.
data: gwa_variant1  LIKE disvariant,
        gwa_variant   LIKE disvariant,
        gf_repid     LIKE sy-repid,
       gf_exit(1)   TYPE c,
       gf_save(1)   TYPE c.
INITIALIZATION.
  gf_repid = sy-repid.
  gf_save = 'A'.
  CLEAR gwa_variant.
  gwa_variant-report = gf_repid.
  gwa_variant1 = gwa_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      i_save     = gf_save
    CHANGING
      cs_variant = gwa_variant1
    EXCEPTIONS
      not_found  = 2.
  IF sy-subrc = 0.
    p_vari = gwa_variant1-variant.
  ENDIF.
AT SELECTION-SCREEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = gwa_variant
      i_save     = gf_save
    IMPORTING
      e_exit     = gf_exit
      es_variant = gwa_variant1
    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.
      p_vari = gwa_variant1-variant.
    ENDIF.
  ENDIF.
   IF NOT p_vari IS INITIAL.
    MOVE gwa_variant TO gwa_variant1.
    MOVE p_vari TO gwa_variant1-variant.
  CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        i_save     = gf_save
      CHANGING
        cs_variant = gwa_variant1.
    gwa_variant = gwa_variant1.
  ELSE.
    CLEAR gwa_variant.
     gwa_variant-report = gf_repid.
     ENDIF.
end-of-selection.
  gf_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = gf_repid
      it_fieldcat        = gt_catalog
      it_sort            = gt_sort
      it_events          = gt_events
      i_save             = gf_save
      is_variant         = gwa_variant
    TABLES
      t_outtab           = gt_output
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.     
Hope this helps.
Regards,
Ramya

Similar Messages

  • Layout saving in alv

    can any1 suggest me a link or some idea on using a layout in alv.
    wat i mean by layout here is not grid layout,but the layout which can be saved
    to be more specific i was just goin through programs which used these func modules reuse_alv_variant_f4  to select the layout and 1 more function module to save.
    I did not understand some part of these function modules n how exactly to use them, so if any1 can put some light on it??????

    for saving layout in alv list or grid
    just give
    i_save = 'A'.
    it will give you option to save the layout.
    regards
    shiba dutta

  • Regarding layout in the alv grid report

    hi gurus,
    i  have created a ALV report in which the output is coming allrt having 13 fields.now i have saved my layout depending upon some columns in the output name "AVI layout" containg 3 fileds.
    when ever i execute the report the layout having 13 fields is coming what i want that whenever i execute the report the  layout which i saved means "AVI layout" will come automatically.
    please help me................

    Hi,
    You use in your fieldcatlog NO_OUT option for all fields except those 3 fields which u want display when the report executes...
    fieldcatlog-no_out = 'X'.
    In out put when ever they want to see other fields they can select in output itself and display them....

  • Layout saved in ALV is stored in which table?

    Hi,
    Where does all the fields which are hidden from the layout in ALV are stored ..i mean i want to know for a pertcular layour which all fields are hidden and where is this detail data stored...
    any pointer on the same is welcome..
    Regards
    Gunjan

    hi,
    call this FM to know which fields are used.
    CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
            i_dialog               =  'N'
            i_user_specific     =  'A'
            i_default               = 'X'
            it_default_fieldcat  = g_fcat
            i_layout               = g_layout
          IMPORTING
            et_fieldcat           = g_fcat
            es_layout            = g_layout
          CHANGING
            cs_variant           = g_variant.
    loop at g_fcat( field catalog ).
    check the no_out field
    if no_out = '  '   then the field is in hidden column
    or if no_out  = 'X'  then the field is in display column
    endloop.
    reward if helpful.

  • Layout use in alv

    Hi,
        I have saved three layouts on alv grid display screen.
    I have given three radio buttons on screen to select any one of them.
    But I dont know how to pass the layout name to alv grid.
    Please if any one cud help.

    Hi Shashank,
    To use variant for different layout, use code:-
    First take three radiobuttons in a single group, so that you can select only on of them.
    PARAMETERS : p_rad1 RADIOBUTTON GROUP gp1 DEFAULT 'X', "for layout 1
                 p_rad2 RADIOBUTTON GROUP gp1, "for layout 2
                 p_rad3 RADIOBUTTON GROUP gp1. "for layout 3
    DATA : v_layout(10).
    Now check which radiobutton is checked.
    AT SELECTION-SCREEN.
    IF p_rad1 = 'X'.
      v_layout = 'VAR1'. "assign value for layout 1
    ELSEIF p_rad2 = 'X'.
      v_layout = 'VAR2'. "assign value for layout 2
    ELSEIF p_rad3 = 'X'.
      v_layout = 'VAR3'. "assign value for layout 3
    ENDIF.
    Now in v_layout you have the value for variant whose layout is to be used.
    Just use this variable is FM 'REUSE_ALV_GRID_DISPLAY'.
    *          DISPLAY RECORDS IN ALV GRID
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
        i_callback_program                = sy-repid "report id
        it_fieldcat                       = it_field "field catalog
        it_sort                           = it_sort "record sort info
        i_save                            = 'A' "for variant
        is_variant                        = v_variant "variant name
       TABLES
        t_outtab                          = itab "internal table with records
       EXCEPTIONS
        program_error                     = 1
        OTHERS                            = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • 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

  • 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

  • DB Table for Layout Variant in ALV report

    Please help me by providing the table name which will get an entry when we save Layout Variant in ALV(OO ALV grid) output.

    Hi,
    I have seen the table LTDX which is giving me the Variant names for a particular program. Hope this will help you.
    Database table is LTDX
    Database view is V_LTDX.
    Regards,
    Venaktesh

  • SAVE Layout Option in ALV list Report

    Hi Experts,
    Is it possible to SAVE the layout option for Block ALV list Reports?
    Thanks in Advance,
    Sivak.

    Hi,
    It is not possible to save layout in BLock ALV display but possible to change layout. There is no parameter to save. It is not possible to store the layout as it has several structure.
    Thanks & Regards
    Rocky

  • Auth. obj. controlling layout saving for a COPA report

    Hello,
    Could someone please guide me on which authorization object controls the capability to use the menu option : Settings , Layout, Saving...   for a COPA report.
    The problem is that this options appears dimmed for the users.
    Thank you in advance for your cooperation.
    Best regards.
    Reda Khalifa

    Hi,
    Could you check these authority check objects S_RS_COMP and S_RS_COMP1.
    Thanks,
    NN

  • 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

  • Layout selection in ALV grid.

    Hi All,
    I have one requirement to change the existing program. Currently it is displaying all the fields in the ALV grid. Now i need to make the selection screen with two options for Header data selection and Item data selection. So now if I select the Header data only to be displayed (in the coding I made the changes in the field catalog and hidded some fields using
                                 WHEN 'FKART'
                                  if p_header = 'X'.
                                   <fc>-no_out = 'X'.
                                  endif.
    so now it should not display the FKART field in the output. My question is, If I select some different layout in the ALV GRID  even this hidden header fields are also getting displayed. Please help me and give me the solution for this.
    Regards,
    AL.

    Hi Anbu,
    You can try like this,  Modify your Col Position like this...
    IF P_HEARDER = 'X'.
      COL_POS = COL_POS + 1.
      FIELDCATALOG-COL_POS     = COL_POS.
      FIELDCATALOG-FIELDNAME   = 'FKART'.
      FIELDCATALOG-OUTPUTLEN   = 10.
      FIELDCATALOG-NO_OUT     = 'X'.
      APPEND FIELDCATALOG TO FIELDCATALOG.
    ELSE.
      COL_POS = COL_POS + 1.
      FIELDCATALOG-COL_POS     = COL_POS.
      FIELDCATALOG-FIELDNAME   = 'FKART'.
      FIELDCATALOG-OUTPUTLEN   = 10.
      APPEND FIELDCATALOG TO FIELDCATALOG.
    ENDIF.
    Thanks & regards,
    Dileep .C

  • Is it possible to transport the layouts of an alv-grid?

    Hello,
    is it possible to transport the layouts of an alv-grid and does anybody know how to do this?
    Regards, Lars.

    Hi
    LS_VARI  TYPE DISVARIANT.
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
    CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
    <b>      IS_VARIANT           = LS_VARI</b>
          IS_LAYOUT            = GS_LAYOUT
    <b>      I_SAVE               = 'A'</b>
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = IT_FINAL[].
    try this
    regards
    vijay

  • How to change the standard layout sets in ALV List

    Hi Gurus,
    How to change the standard layout sets in ALV list.
    Is there any standard program ? or specific way to acheive this?
    Kindly drop some clues?Every valuable clues rewarded more points........
    Thanks in Advance,
    Dharani

    Hello Dharani
    All required function modules can be found in function group SLVC (assuming that you are using OO-based ALV or, at least, fm REUSE_ALV_GRID_DISPLAY_LVC):
    LVC_VARIANT_DEFAULT_GET (Read default display variant (description only, w/o field catalog))
    LVC_VARIANT_EXISTENCE_CHECK
    LVC_VARIANT_F4 (Display variant selection dialog box)
    LVC_VARIANT_SELECT (Read a display variant)
    For a sample report using LVC_VARIANT_DEFAULT_GET have a look at BCALV_GRID_10.
    Regards,
      Uwe

  • 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

Maybe you are looking for