Searching for ALV grid layout variants

How can I find weather there are any saved layout variants? I tried some functions like LVC_VARIANT_F4, but I do not need any pop-ups and so on. I need only to are there any saved variants or no.
Thanks in advance
Regards
Peter Yordanov

just declare like this and pass to IT_RA_REPORT.
ranges: lr_report for ltdx-report.
  lr_report-sign = 'I'.
  lr_report-option = 'EQ'.
  lr_report-low    = gc_repid.
  append lr_report.
and pass lr_report to   FM   LT_VARIANTS_READ_FROM_LTDX
call function 'LT_VARIANTS_READ_FROM_LTDX'
       tables
            et_variants     = lt_variants
            it_ra_report    = lr_report
            it_ra_handle    = lr_handle
            it_ra_log_group = lr_log_group
            it_ra_username  = lr_username
            it_ra_variant   = lr_variant
            it_ra_type      = lr_type
       exceptions
            not_found       = 1
            others          = 2.

Similar Messages

  • Create unique handle for ALV grid layout

    Hi,
    in some generic classes we display internal tables in a grid. We want to activate the save&maintain layouts feature by passing the DISVARIANT structure, Here wen have to give Report and handle. As we display some more tables using the same method, we must set a unique handle so that saved ALV layouts do not get merged /confused. As we do not have a table name at this point, my idea is to create a hash key based on the fields in the field catalog (field catalog is only distinguishable object here).
    I need an algorithm to create the 4-character handle as a hash value based on the (concatenated) field names in field catalog.
    Or a better idea to create unique handles in the generic ALV calls in one program.
    Please: Serious answers only.
    Regards,
    Clemens

    Here it is
    function enqueuecomputehash.
    *"*"Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(INPUT) TYPE  STRING
    *"     VALUE(INPUT_LEN) TYPE  I
    *"     VALUE(HASH_LEN) TYPE  I
    *"  EXPORTING
    *"     REFERENCE(HASH) TYPE  STRING
    *"     REFERENCE(TIME_USEC) TYPE  I
    *"  EXCEPTIONS
    *"      INVALID_ARGUMENT
    field-symbols <text>.
    field-symbols <hash>.
    data: tmp_input type text8192.
    data: tmp_hash  type text8192.
    if input_len < 1 or hash_len < 1.
       raise invalid_argument.
    endif.
    assign tmp_input(input_len) to <text>.
    assign tmp_hash(hash_len) to <hash>.
    data: t1 type i,
          t2 type i.
    <text> = input.
    get run time field t1.
    call 'C_ENQ_WILDCARD' id 'TEXT'     field <text>
                          id 'TEXTHASH' field <hash>.
    get run time field t2.
    hash = <hash>.
    time_usec = t2 - t1.
    endfunction.

  • ALV Grid Layouts - Setting them user-specific

    Hi everybody -
    I am using the ALV grid layout for a report using function module REUSE_ALV_GRID_DISPLAY.  There are a number of fields that are not immediately viewed on screen - they are in hide mode within the field catalog.  We want to allow the users to add them / remove them from the report using an ALV variant.
    I can allow the users to add/remove with a layout variant no problem - but I am having an issue allowing them to save the variant that they are using to view the data, as user-specific.  For whatever reason, they are only allowed to save their layout variants as global - the "User-specific" box is grayed out.
    Does anyone know how I can get the "User Specific" box to be NOT grayed out within an ALV grid?
    Thanks!
    Abby

    Set the I_SAVE parameter to 'U' in your function call.
    Regards
    Rich Heilman

  • Alv grid layout display in 2 pages

    Hi All,
    I am presently working in ALV programming.
    The client requierment is "GL line items and summary sheet will be listed in separate pages."
    i am dispalying the output using ALV grid layout display.
    Can you please conform that how to write logic for summary sheet.that will display after the line items and also saparate page.
    Thanks,
    Sridhar

    Hi ,
          Use event END OF PAGE .
    Write a Form for end of page
    then do calcualtions.
    Reward if useful.

  • How to use Style in LVC_S_LAYO (ALV Grid Layout)

    Hi Experts,
    I am trying to set field 'STYLEFNAME' of LVC_S_LAYO while setting up layout for ALV GRID using 'SET_TABLE_FOR_FIRST_DISPLAY' . I'm passing the field name contain the styles for each row. I am setting it in the same way we set 'INFO_FNAME' by passing color field name for coloring the rows. Styles are available in include <CL_ALV_CONTROL> .
    Please note styles are working properly when I am setting it at field cat level by setting fieldcat field LVC_S_FCAT-STYLE. But set sets style for entire column. I want to set style for few rows. I want to use style 'ALV_STYLE_BUTTON' .
    Please advice how to do this.
    Regards,
    Sushant.

    I'll try to understand your question.
    You have a 'new-style' alv and want to show some fields as pushbutton.
    To make a cell to be displayed as a pushbutton, we have two steps.
    Firstly, insert a new inner table of type u201CLVC_T_STYLu201D into your list data table.
    *--- Internal table holding list data
    DATA BEGIN OF gt_list OCCURS 0 .
    INCLUDE STRUCTURE SFLIGHT .
    DATA rowcolor(4) TYPE c .
    DATA cellcolors TYPE lvc_t_scol .
    DATA carrid_handle TYPE int4 .
    DATA connid_handle TYPE int4 .
    DATA cellstyles TYPE lvc_t_styl .
    DATA END OF gt_list .
    Fill this inner table for each field to be displayed as pushbutton.
    DATA ls_style TYPE lvc_s_styl .
    READ TABLE gt_list INDEX 7 .
    ls_style-fieldname = 'SEATSMAX' .
    ls_style-style = cl_gui_alv_grid=>mc_style_button .
    APPEND ls_style TO gt_list-cellstyles .
    MODIFY gt_list INDEX 7 .
    As usual, we state our list data table field related with styles in the layout structure at field u2018STYLEFNAMEu2019.
    e.g. ps_layout-stylefname = 'CELLSTYLES' .
    Button click event is handled like hotspot click via the event u201Cbutton_clicku201D through its parameters u201Ces_col_idu201D and u201Ces_row_nou201D which contain the address of the clicked pushbutton cell.

  • I need simple example for alv grid

    hi
    i need code for simple example for alv grid.
    thanks.

    hi bharat,
                  this is report with most of the functionality.
    report zus_alv_demo_grid .
    tables:     ekko.
    type-pools: slis.
    types: begin of t_ekko,
    ebeln type ekpo-ebeln,
    ebelp type ekpo-ebelp,
    statu type ekpo-statu,
    aedat type ekpo-aedat,
    matnr type ekpo-matnr,
    menge type ekpo-menge,
    meins type ekpo-meins,
    netpr type ekpo-netpr,
    peinh type ekpo-peinh,
    line_color(4) type c, "Used to store row color
    end of t_ekko.
    data: it_ekko type standard table of t_ekko initial size 0,
           wa_ekko type t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    Data declaration for EVENT and PRINT PARAMETER.
    data: gt_events type slis_t_event,
           gd_prntparams type slis_print_alv.
    data declaration for sorting.
    data : it_sortcat   type slis_sortinfo_alv occurs 1,
           wa_sort like line of it_sortcat.
    data :  i_list_comments type slis_t_listheader.
    start-of-selection.
      perform data_retrieval.
    perform user_command.
      perform build_fieldcatalog.
      perform build_layout.
      perform build_events.
      perform build_print_params.
      perform build_sortcat.
      perform display_alv_report.
    end-of-selection.
    *TOP-OF-PAGE.
    PERFORM top-of-page.
    end-of-page.
    *&      Form  build_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      fieldcatalog-do_sum = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " build_fieldcatalog
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for
    *when double
                                            "click(press f2)*
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " build_layout
    *&      Form  data_retrieval
          text
    -->  p1        text
    <--  p2        text
    form data_retrieval.
      data: ld_color(1) type c.
      select ebeln ebelp statu aedat matnr menge meins netpr
    peinh from ekpo  into table it_ekko.
    *Populate field with color attributes
      loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
        ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
        if ld_color = 8.
          ld_color = 1.
        endif.
        concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
        modify it_ekko from wa_ekko.
      endloop.
    endform.                    " data_retrieval
    *&      Form  display_alv_report
          text
    -->  p1        text
    <--  p2        text
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = gd_repid
                is_layout                = gd_layout
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                i_callback_user_command  = 'USER_COMMAND'
                i_callback_pf_status_set = 'SET_PF_STATUS'
                it_event                 = gt_events
                is_print                 = gd_prntparams
                it_fieldcat              = fieldcatalog[]
                it_sort                 = it_sortcat
                i_save                   = 'X'
           tables
                t_outtab                 = it_ekko
           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.
    endform.              " DISPLAY_ALV_REPORT
    *&      Form  user_command
          text
    -->  p1        text
    <--  p2        text
    *&      Form  top-of-page
          text
    -->  p1        text
    <--  p2        text
    form top-of-page.
    *ALV Header declarations
      data: t_header type slis_t_listheader,
            wa_header type slis_listheader,
            t_line like wa_header-info,
            ld_lines type i,
            ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      concatenate  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
       sy-datum(4) into wa_header-info."todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
         into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
           it_list_commentary = t_header
           i_logo             = 'GANESH_LOGO'.
    endform.                    " top-of-page
          FORM user_command                                             *
    -->  R_UCOMM                                                       *
    -->  RS_SELFIELD                                                   *
    form user_command using r_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case r_ucomm.
        when '&IC1'.
          if rs_selfield-fieldname = 'EBELN'.
            read table it_ekko into wa_ekko index rs_selfield-tabindex.
            set parameter id 'BES' field wa_ekko-ebeln.
            call transaction 'ME23N' and skip first screen.
          endif.
        when 'ULHAS'.
          if rs_selfield-fieldname = 'EBELN'.
            read table it_ekko into wa_ekko index rs_selfield-tabindex.
            set parameter id 'BES' field wa_ekko-ebeln.
            call transaction 'ME23N' and skip first screen.
          endif.
      endcase.
    endform.
          FORM set_pf_status                                            *
    -->  RT_EXTAB                                                      *
    form set_pf_status using rt_extab type slis_t_extab.
      set pf-status 'ZNEWSTATUS'.
    endform.
    *&      Form  build_events
          text
    -->  p1        text
    <--  p2        text
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
       exporting
         i_list_type           = 0
       importing
         et_events             = gt_events[]
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
      read table gt_events with key name =  slis_ev_end_of_page
                  into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
      read table gt_events with key name =  slis_ev_end_of_list
                  into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " build_events
    *&      Form  build_print_params
          text
    -->  p1        text
    <--  p2        text
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " build_print_params
          FORM END_OF_PAGE                                              *
    form end_of_page.
      data: listwidth type i,
      ld_pagepos(10) type c,
      ld_page(10)    type c.
      write: sy-uline(50).
      skip.  write:/40 'Page:', sy-pagno .
    endform.
          FORM END_OF_LIST                                              *
    form end_of_list.
      data: listwidth type i,
      ld_pagepos(10) type c,
      ld_page(10)    type c.
      skip.  write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  build_sortcat
          text
    -->  p1        text
    <--  p2        text
    form build_sortcat.
    wa_sort-spos      = 1.
    wa_sort-fieldname = 'EBELN'.
    append wa_sort to it_sortcat.
    wa_sort-spos      = 2.
    wa_sort-fieldname = 'EBELP'.
    append wa_sort to it_sortcat.
    endform.                    " build_sortcat
    Rewards if helpfull
    regards
    vijay dwivedi

  • F.01 Summary Report for ALV grid

    Hi all,
    We have defined our financial statement version (FSV). We have been running tests in transaction F.01, when we choose ALV Tree output the transaction works perfectly.
    However, if we choose ALV grid output and then choose "1" in the Summary Report field (highest summary level, only main points of Balance sheet P&L statement should be displayed) the output is not summarized at all.
    In short, no matter what number we put in the Summary Report field we always get the same output.
    What needs to be done in order to be able to use this summarization control?
    Any help will be appreciated.
    Juan
    Edited by: Juan Carlos Mier Giraud on Jul 8, 2008 4:50 PM

    Renata,
    Thanks for your help. I am going to need a bit of help to develop the solutions described in the notes you pointed out.
    Have you successfully created a summarization for ALV grid output?
    I just want to know if it is worthy to devote time to it or just use classic list or ALV tree when appropiate.
    Regards

  • How can i apply border for fluid grid layout div

    How can i apply border for fluid grid layout div

    <!doctype html>
    <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
    <!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
    <!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <html class="">
    <!--<![endif]-->
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Untitled Document</title>
    <link href="boilerplate.css" rel="stylesheet" type="text/css">
    <link href="CSS/Layout.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="flexslider.css" type="text/css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script src="jquery.flexslider.js"></script>
    <!-- Place in the <head>, after the three links -->
    <script type="text/javascript" charset="utf-8">
      $(window).load(function() {
        $('.flexslider').flexslider();
    </script>
    <!--
    To learn more about the conditional comments around the html tags at the top of the file:
    paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
    Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):
    * insert the link to your js here
    * remove the link below to the html5shiv
    * add the "no-js" class to the html tags at the top
    * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build
    -->
    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="respond.min.js"></script>
    </head>
    <body>
    <div class="gridContainer clearfix">
      <div id="LayoutDiv1"><img src="SJV-Images/Banners/Dark-green-curved-header.png"/></div>
      <div id="LayoutDiv2">
      <div class="flex-container">
      <div class="flexslider">
        <ul class="slides">
          <li>
            <img src="SJV-Images/Stud1.jpg"/>
          </li>
          <li>
            <img src="SJV-Images/Stud2.jpg" />
          </li>
          <li>
            <img src="SJV-Images/Stud3.jpg" />
          </li>
        </ul>
      </div>
    </div> </div>
      <div id="Nav">This is the content for Layout Div Tag "Nav"</div>
      <div id="Special_Features"><h3 align="center">SPECIAL FEATURES</h3>
      <ul>
      <li>
      It is one of the oldest school.</li>
      <li>It was first started as an orphanage for the children of British soldiers, and later moved to its current location.</li>
       <li>Rich in Anglo-Indian tradition dating back to three centuries.</li>
      <li>The campus now has separate buildings within the campus for year 1 to  year 8 (Junior and Sub Junior block) and year 9 to year 12 (Senior and   Super Senior block).</li>
      <li>The school has montessori facilities in a separate building.</li>
      <li>The School also has boarding facilities for students from distant places.</li>
      </ul></div>
      <div id="History"><img src="SJV-Images/His_Image.png" alt="Hisimage" class="floatleft">
      <h3>HISTORY OF OUR SCHOOL</h3><P>In 1750 – a very long time ago,a missionary and a teacher, Christian Frederick Schwartz came to India to work in the Danish Mission at Tranquebar.Due to his own personal charm, genius and integrity, soon he became a trusted envoy to the court of Princes ,both hostile and friendly. He even helped in the training and education of Serfogee Rajah, the adopted son of the Tanjore Raja Tuljagee.</P></div>
    <div id="Photo_Gall"><center>
        <strong>PHOTO GALLERY</strong>
    </center>
      <p><img src="SJV-Images/Photogall.png" width="174" height="70" class="floatright"/></p>
    </div>
      <div id="News_Events"><center>
        <strong>NEWS & EVENTS</strong>
      </center><center>Annual Day<br><center>
        Alumni Meet<br>
        Exam Time Table<br>Parents-Teacher's Meet</center>
      </center>
      <br></div>
      <div id="footer">This is the content for Layout Div Tag "footer"</div>
    </div>
    </body>
    </html>

  • Need a perfect example program for ALV GRID LIST

    first hi to all,i am new to this community.i am still in learning process of SAP.one of my friend suggeted this community and i think this is the perfect place to learn and excel my skill in SAP.so my requirement is a perfect example program for ALV GRID LIST DISPLAY.while i am trying another program,the sysntax is ok but i am not getting any output and it is not showing any error also.hope i will get an answer asap.thank you.

    Check [OO ALV Guide Simple|http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide] and [Easy Reference to ALV|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

  • How to set variant for ALV grid from ABAP

    Hello,
    I have a program which displays some data with ALV grid. Then after some operation I would like to set different layout for the grid, but not by choosing it manually but by the program. I thought that it would be enough to use the method SET_VARIANT, so I'm setting DISVARIANT structure properly, using SET_VARIANT method and after that I'm calling REFRESH_TABLE_DISPLAY but layout is not changed. What else should I do? Is that possible?
    Best regards,
    Marcin

    Hi,
    Check this
    * While declaring select-options
    parameters: p_vari        like ltdx-variant.  " Layout
    * then add the following code in
    at selection-screen on value-request for p_vari.
      perform f_variant_f4 using p_vari.
    * Code for f_variant_f4
    form f_variant_f4 using  p_vari.
    * private variables
      data : v_exit    type c.
      clear gs_variantt.
      v_variant_save = 'U'.
      call function 'LVC_VARIANT_F4'
        exporting
          is_variant    = gs_variant
          i_save        = v_variant_save
        importing
          e_exit        = v_exit
          es_variant    = gs_variantt
        exceptions
          not_found     = 1
          program_error = 2
          others        = 3.
      if sy-subrc ne c_0.
        message i999(yscc) with text-064.    " No Layout Available for F4
      endif.
      if v_exit is initial.
        gs_variant-variant = gs_variantt-variant.
        p_vari             = gs_variantt-variant.
      endif.
    endform.                                 " F_variant_f4
    * In PBO
        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.

  • How to download only some fields(dynamically) from alv grid layouts

    I have ALV grid list.
    I have layouts for selecting sets of fields dynamically.
    If I select a particular layout, I want to download only those fields into an Excel sheet.
    If I select another layout, I want to download only fields of that layout , into an Excel sheet.
    Can u plz write examples.
    Narendra

    Hello ,
    Here it is.
      FIELD-SYMBOLS <FS> TYPE ANY.
      DATA: GR_ATTACHMENT TYPE Z48S3_ATTACHMENT,
            GT_ATTACHMENT TYPE Z48S3_ATTACHMENT_TAB,
            L_F_TITLE     TYPE SO_OBJ_DES,
            L_R_FIELDCAT  LIKE LINE OF GT_FIELDCAT,
            L_F_FIELD     LIKE L_R_FIELDCAT-FIELDNAME,
            L_F_EMAILID   TYPE Z48S3_RECEIVER,
            L_F_FIRST     TYPE C.
      IF SY-SYSID EQ G_C_DEV_SYSTEM OR
         SY-SYSID EQ G_C_QUA_SYSTEM.
        CONCATENATE SY-SYSID '/' SY-MANDT ':' INTO L_F_TITLE.
        CONDENSE L_F_TITLE.
        CONCATENATE L_F_TITLE SY-TITLE INTO L_F_TITLE SEPARATED BY SPACE.
      ELSE.
        L_F_TITLE = SY-TITLE.
      ENDIF.
      G_R_VARIANT-REPORT = SY-REPID.
      G_R_VARIANT-VARIANT = P_VARIAN.
      CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
           EXPORTING
                I_DIALOG            = 'N'
                I_USER_SPECIFIC     = 'A'
                I_DEFAULT           = 'X'
                IT_DEFAULT_FIELDCAT = G_T_FIELDCAT
                I_LAYOUT            = GR_LAYOUT
           IMPORTING
                ET_FIELDCAT         = G_T_FIELDCAT
                ES_LAYOUT           = GR_LAYOUT
           CHANGING
                CS_VARIANT          = G_R_VARIANT
           EXCEPTIONS
                ERROR_MESSAGE       = 4
                OTHERS              = 4.
      SORT G_T_FIELDCAT BY COL_POS.
      PERFORM CREATE_EXCEL_ATTM_HEADING_ROW TABLES GT_ATTACHMENT
                                                   G_T_FIELDCAT.
      LOOP AT G_T_ALVLIST.
        L_F_FIRST = 'X'.
        LOOP AT G_T_FIELDCAT INTO L_R_FIELDCAT WHERE NO_OUT IS INITIAL.
          CLEAR GR_ATTACHMENT-XNEWLINE.
          IF NOT L_F_FIRST IS INITIAL.
            GR_ATTACHMENT-XNEWLINE = 'X'.
            CLEAR L_F_FIRST.
          ENDIF.
          CLEAR L_F_FIELD.
          CONCATENATE 'G_T_ALVLIST-' L_R_FIELDCAT-FIELDNAME
                 INTO L_F_FIELD.
          CONDENSE L_F_FIELD.
          ASSIGN (L_F_FIELD) TO <FS>.
          WRITE <FS> TO GR_ATTACHMENT-FIELDVALUE.
          UNASSIGN <FS>.
          APPEND GR_ATTACHMENT TO GT_ATTACHMENT.
        ENDLOOP.
      ENDLOOP.
    Regards,
    Vasanth

  • Alv grid layout as default.

    In an alv grid you can personalize the layout (Change layout, save layout). Is it possible to somehow add this saved layout to the report so that it will be shown as the defaylt layout for eveyone that runs the report?
    Best Regards Claes

    Hello Rich Heilman and thank you for your help.
    I solved the problem as you suggested in the first example. This has worked great but now i need to set different layouts depending of what the user chooses. This i have not solved yet.
    Is there anything else that I need to do except create the layouts with those names <i>/Y23HPAREsum</i> and <i>Y23HPAREind</i> as you se in the code below?
    data:  variant type disvariant.
           variant-report = sy-repid.
      if p_sum eq 'X'.
           variant-VARIANT = '<i>/Y23HPAREsum</i>'.
           else.
           variant-VARIANT = '<i>Y23HPAREind</i>'.
      endif.
    form reuse_alv_list_display.
      data : l_repid like sy-repid.
      move sy-repid to l_repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program     =   l_repid
          i_callback_top_of_page =   st_formname_top_of_page
          it_fieldcat            =   st_fieldcat[]
            i_save               =   'X'
            is_variant           =   variant
        tables
          t_outtab               = lt_rec.
    endform.                               " REUSE_ALV_LIST_DISPLAY
    Best Regards Claes

  • Hotspot click  in methods for alv grid list

    Hi all ,
    i written a program for grid display and hotspot click.
    but it is not capturing the value at the event hotspot click,
    please anybody help me in capturing the value in the following code.
    it will be great will it happens soon.
    REPORT zag_tables MESSAGE-ID zag .
    DATA : gt_tables TYPE TABLE OF  zag_tables,
           gs_tables type zag_tables.
    DATA : gt_cust_cont TYPE REF TO cl_gui_custom_container       ,
           gt_alv_grid TYPE REF TO cl_gui_alv_grid,
           gt_cont TYPE scrfname VALUE 'ZAG_TABLES'.
    *data declarations for grid layout
    DATA : gt_fieldcat TYPE lvc_t_fcat,
           gs_fieldcat TYPE lvc_s_fcat,
           gs_layout TYPE lvc_s_layo,
           gs_variant TYPE disvariant.
    DATA : gv_repid TYPE syrepid,
            okcode TYPE syucomm..
    *data : gs_row_id type lvc_s_row,
          gs_col_id type lvc_s_col,
          gs_row_no type lvc_s_roid.
    data : e_row_id type lvc_s_row,
           gs_col_id type lvc_s_col,
           gs_row_no type lvc_s_roid.
    *CLASS DEFINITIONS
    CLASS cl_event_handler  DEFINITION.
      PUBLIC SECTION.
    CLASS-METHODs  : cm_hotspot_click FOR EVENT  hotspot_click OF
                      cl_gui_alv_grid IMPORTING
                      e_row_id e_column_id es_row_no .
    ENDCLASS.
          CLASS cl_event_handler IMPLEMENTATION
    CLASS cl_event_handler IMPLEMENTATION.
      METHOD : cm_hotspot_click .
      PERFORM hotspot_click.
    ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
      PERFORM select_data.
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    FORM select_data.
      SELECT  *  FROM zag_tables INTO TABLE gt_tables.
    ENDFORM.                    " select_data
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZAG_TABLES'.
      SET TITLEBAR 'ZAG_TABLES'.
      gv_repid  = sy-repid.
      IF gt_cust_cont IS INITIAL.
        CREATE OBJECT gt_cust_cont
          EXPORTING
            container_name              = gt_cont
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            others                      = 6
        IF sy-subrc <> 0.
        ENDIF.
        CREATE OBJECT gt_alv_grid
          EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
            i_parent          = gt_cust_cont
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_USE_VARIANT_CLASS = SPACE
       I_NAME            =
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5
        IF sy-subrc <> 0.
        ENDIF.
      ELSE.
        CALL METHOD gt_alv_grid->refresh_table_display
          EXCEPTIONS
            finished       = 1
            OTHERS         = 2
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    *perform layout changing gs_layout.
      PERFORM  fieldcat CHANGING gt_fieldcat.
    *perform variant changing gs_variant.
      gs_layout-zebra   = 'X'.
      gs_layout-sel_mode = 'A'.
      gs_variant-report = gv_repid.
      SET HANDLER cl_event_handler=>cm_hotspot_click FOR gt_alv_grid.
      CALL METHOD gt_alv_grid->set_table_for_first_display
        EXPORTING
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
          is_variant                    = gs_variant
          i_save                        = 'A'
          i_default                     = 'X'
          is_layout                     = gs_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
        CHANGING
          it_outtab                     = gt_tables
          it_fieldcatalog               = gt_fieldcat
       IT_SORT                       =
       IT_FILTER                     =
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4
      IF sy-subrc <> 0.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  fieldcat
          text
         <--P_GS_fieldcat  text
    FORM fieldcat CHANGING gt_fieldcat  TYPE lvc_t_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
      I_BUFFER_ACTIVE              =
         i_structure_name             = 'ZAG_TABLES'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_BYPASSING_BUFFER           =
        CHANGING
          ct_fieldcat                  = gt_fieldcat
       EXCEPTIONS
         inconsistent_interface       = 1
         program_error                = 2
         OTHERS                       = 3
      IF sy-subrc <> 0.
      ENDIF.
      LOOP AT gt_fieldcat INTO gs_fieldcat.
        gs_fieldcat-fieldname = 'MANDT'.
        gs_fieldcat-no_out     = ''.
        MODIFY gt_fieldcat  FROM gs_fieldcat.
        gs_fieldcat-fieldname = 'Z_TABLES'.
        gs_fieldcat-hotspot     = 'X'.
        MODIFY gt_fieldcat  FROM gs_fieldcat.
      ENDLOOP.
    ENDFORM.                    " fieldcat
    *&      Form  layout
          text
    -->  p1        text
    <--  p2        text
    *form layout changing gs_layout.
    *gs_layout-zebra = 'X'.
    *gs_layout-sel_mode = 'A'.
    *endform.                    " layout
    *&      Form  variant
          text
         <--P_GS_variant  text
         <--P_ENDMODULE  text
    *form variant changing gs_variant
      gs_variant-report = gv_repid.
    *endform.                    " variant
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      TRANSLATE okcode TO UPPER CASE.
      CASE okcode.
        WHEN 'EXIT' OR 'BACK' OR 'CANCEL'.
          LEAVE TO  SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  hotspot_click
          text
    -->  p1        text
    <--  p2        text
    FORM hotspot_click ."importing gs_row_id type lvc_s_row.
    data : lv_prog type syrepid,
           lv_tcode type tcode.
    read table gt_tables into gs_tables index e_row_id-index.
    if sy-subrc eq 0 and gs_col_id-fieldname = 'ZTABLES'.
    move gs_tables-z_tables to lv_prog.
    translate lv_prog to upper case.
    select single tcode from tstc into lv_tcode where pgmna = lv_prog.
    call transaction lv_tcode.
    endif.
    ENDFORM.                    " hotspot_click
    thanks in advance..
    pls

    Hi  ,
    please  go through this  Program   it was  handled  by Hot spot  only  .
    report zbnstest.
    * TABLES AND DATA DECLARATION.
    *TABLES: mara,makt.",marc.
    data syrepid like sy-repid.
    data sydatum(10). " LIKE sy-datum.
    data sypagno(3) type n.
    * WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
    * GROUP (TYPE-POOLS--------->SLIS)
    type-pools : slis.
    * INTERNAL TABLE DECLARATION.
    * INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    mtart like mara-mtart,
    matkl like mara-matkl,
    end of t_mara.
    * INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
    data : begin of t_marc occurs 0,
    matnr like mara-matnr,
    werks like marc-werks,
    minbe like marc-minbe.
    data: end of t_marc.
    * INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
    data : begin of t_makt occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    spras like makt-spras,
    end of t_makt.
    * INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
    data: begin of itab1 occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    maktx like makt-maktx,
    spras like makt-spras,
    werks like marc-werks,
    minbe like marc-minbe,
    end of itab1.
    * THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
    * AND THE LAYOUT FOR THE ALV.
    * HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
    * WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
    * OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
    * THIS IS DONE TO MAKE THE CODE SIMPLER.
    * OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
    * PROGRAMS.
    * IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
    * MORE TABLES AND CREATE A STRUCTURE
    * IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
    * LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    fieldlayout type slis_layout_alv.
    * DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
    * TOP-OF-PAGE ETC.
    data : eventstab type slis_t_event with header line.
    * DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
    data : heading type slis_t_listheader with header line.
    data : heading1 type slis_t_listheader with header line.
    data : heading2 type slis_t_listheader with header line.
    data : heading3 type slis_t_listheader with header line.
    data : heading4 type slis_t_listheader with header line.
    data : heading5 type slis_t_listheader with header line.
    data : heading6 type slis_t_listheader with header line.
    data : heading7 type slis_t_listheader with header line.
    data : heading8 type slis_t_listheader with header line.
    * STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
    data : colorstruct type slis_coltypes.
    * INITIALIZATION. *
    initialization.
    syrepid = sy-repid.
    sypagno = sy-pagno.
    clear fieldcatalog.
    * START-OF-SELECTION. *
    start-of-selection.
    * SUBROUTINE TO POPULATE THE COLORSTRUCT
    perform fill_colorstruct using colorstruct.
    * SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
    perform populate_fieldcatalog.
    * SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
    * INTERNAL TABLE.
    perform selectdata_and_sort.
    * SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
    perform populate_layout using fieldlayout.
    * SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
    perform merge_fieldcatalog.
    * SUBROUTINE TO POPULATE THE EVENTSTAB.
    perform fill_eventstab tables eventstab.
    * SUBROUTINE TO POPULATE THE HEADING TABLES.
    perform fill_headingtable tables heading using 'HEADING'.
    perform fill_headingtable tables heading1 using 'HEADING1'.
    perform fill_headingtable tables heading2 using 'HEADING2'.
    perform fill_headingtable tables heading3 using 'HEADING3'.
    perform fill_headingtable tables heading4 using 'HEADING4'.
    perform fill_headingtable tables heading5 using 'HEADING5'.
    perform fill_headingtable tables heading6 using 'HEADING6'.
    perform fill_headingtable tables heading7 using 'HEADING7'.
    perform fill_headingtable tables heading8 using 'HEADING8'.
    * SUBROUTINE TO DISPLAY THE LIST.
    perform display_alv_list.
    * FORMS
    * IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
    * OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
    * COLUMN JUSTIFICATION.
    form populate_fieldcatalog.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATNR' 'X' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MEINS' ' '.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MAKTX' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MTART' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATKL' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'SPRAS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'WERKS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MINBE' ' ' .
    endform. " POPULATE_FIELDCATALOG
    * FORM FILL_FIELDS_OF_FIELDCATALOG *
    * --> FIELDCATALOG *
    * --> P_TABNAME *
    * --> P_FIELDNAME *
    * --> P_KEY *
    * --> P_KEY *
    form fill_fields_of_fieldcatalog tables fieldcatalog
    structure fieldcatalog
    using p_tabname
    p_fieldname
    p_key.
    * p_no_out.
    fieldcatalog-tabname = p_tabname.
    fieldcatalog-fieldname = p_fieldname.
    fieldcatalog-key = p_key.
    fieldcatalog-emphasize = '1234'.
    *fieldcatalog-no_out = p_no_out.
    append fieldcatalog.
    endform. " FILL_FIELDSOFFIELDCATALOG
    * FORM POPULATE_LAYOUT *
    * --> FIELDLAYOUT *
    form populate_layout using fieldlayout type slis_layout_alv.
    fieldlayout-f2code = '&ETA' .
    fieldlayout-zebra = 'X'.
    * FOR THE WINDOW TITLE.
    fieldlayout-window_titlebar = 'ALV with Events'.
    fieldlayout-colwidth_optimize = 'X'.
    fieldlayout-no_vline = ' '.
    *fieldlayout-no_input = 'X'.
    fieldlayout-confirmation_prompt = ''.
    fieldlayout-key_hotspot = 'X'.
    * This removes the column headings if the flag is set to 'X'
    fieldlayout-no_colhead = ' '.
    *fieldlayout-hotspot_fieldname = 'MAKTX'.
    fieldlayout-detail_popup = 'X'.
    * fieldlayout-coltab_fieldname = 'X'.
    endform. " POPULATE_LAYOUT
    * FORM SELECTDATA_AND_SORT *
    form selectdata_and_sort.
    select matnr meins mtart matkl from mara
    into corresponding fields of t_mara
    up to 500 rows .
    select matnr maktx spras from makt
    into corresponding fields of t_makt
    where matnr = t_mara-matnr and
    spras = sy-langu.
    select matnr werks minbe from marc
    into corresponding fields of t_marc
    where matnr = t_mara-matnr.
    append t_marc.
    endselect.
    append t_makt.
    endselect.
    append t_mara.
    endselect.
    perform populate_itab1.
    sort itab1 by matnr.
    endform. " SELECTDATA_AND_SORT
    * FORM MERGE_FIELDCATALOG *
    form merge_fieldcatalog.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
    i_program_name = syrepid
    i_internal_tabname = 'ITAB1'
    * i_structure_name = 'COLORSTRUCT'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = syrepid
    changing
    ct_fieldcat = fieldcatalog[]
    exceptions
    inconsistent_interface = 1
    program_error = 2
    others = 3.
    endform. " MERGE_FIELDCATALOG
    * IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
    * FOLLOWS:-
    * i_callback_program --> CALLING PROGRAM NAME
    * i_structure_name --> STRUCTURE NAME.
    * is_layout --> LAYOUT NAME.
    * it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
    form display_alv_list.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    * I_INTERFACE_CHECK = ' '
    i_callback_program = syrepid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    i_structure_name = 'ITAB1'
    is_layout = fieldlayout
    it_fieldcat = fieldcatalog[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    * THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
    * TOOL BAR
    i_save = 'A'
    * IS_VARIANT = ' '
    it_events = eventstab[]
    * IT_EVENT_EXIT =
    * IS_PRINT =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = itab1
    exceptions
    program_error = 1
    others = 2.
    endform. " DISPLAY_ALV_LIST
    *& Form POPULATE_ITAB1
    * text
    * --> p1 text
    * <-- p2 text
    form populate_itab1.
    loop at t_mara.
    loop at t_makt where matnr = t_mara-matnr.
    loop at t_marc where matnr = t_mara-matnr.
    move-corresponding t_mara to itab1.
    move-corresponding t_makt to itab1.
    move-corresponding t_marc to itab1.
    append itab1.
    endloop.
    endloop.
    endloop.
    endform. " POPULATE_ITAB1
    *& Form FILL_EVENTSTAB
    * text
    * -->P_EVENTSTAB text *
    form fill_eventstab tables p_eventstab structure eventstab.
    * WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
    * INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
    * AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
    * EVENTS NAME.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_eventstab[]
    exceptions
    list_type_wrong = 1
    others = 2.
    * BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
    * THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
    * WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
    * FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
    * IS DYNAMICALY CALLED.
    read table p_eventstab with key name = slis_ev_top_of_page.
    if sy-subrc = 0 .
    move 'TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_coverpage.
    if sy-subrc = 0 .
    move 'TOP_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_coverpage .
    if sy-subrc = 0 .
    move 'END_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_top_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_end_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_list_modify.
    if sy-subrc = 0 .
    move 'LIST_MODIFY' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_list.
    if sy-subrc = 0 .
    move 'TOP_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_page.
    if sy-subrc = 0 .
    move 'END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_list .
    if sy-subrc = 0 .
    move 'END_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    endform. " FILL_EVENTSTAB
    *& Form FILL_HEADINGTABLE
    * text
    * -->P_HEADING text *
    form fill_headingtable tables p_heading structure heading
    using tablename.
    case tablename.
    when 'HEADING'.
    p_heading-typ = 'H'.
    concatenate
    ' REPORT NAME:-' syrepid
    ' ABB Industry Pte Ltd' into p_heading-info.
    append p_heading.
    write sy-datum using edit mask '__/__/____' to sydatum.
    concatenate
    ' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
    into p_heading-info.
    append p_heading.
    when 'HEADING1'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING2'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING3'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
    append p_heading.
    when 'HEADING4'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-END-OF-PAGE'.
    append p_heading.
    * WHEN 'HEADING5'.
    * P_HEADING-TYP = 'H'.
    * P_HEADING-INFO = 'LIST-MODIFY'.
    * APPEND P_HEADING.
    when 'HEADING6'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-PAGE'.
    append p_heading.
    when 'HEADING7'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-LIST'.
    append p_heading.
    when 'HEADING8'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-LIST'.
    append p_heading.
    endcase.
    endform. " FILL_HEADINGTABLE
    * FORM TOP_OF_PAGE *
    form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading[]
    exceptions
    others = 1.
    endform.
    *& Form FILL_COLORSTRUCT
    * text
    * -->P_COLORSTRUCT text *
    form fill_colorstruct using p_colorstruct type slis_coltypes .
    p_colorstruct-heacolfir-col = 6.
    p_colorstruct-heacolfir-int = 1.
    p_colorstruct-heacolfir-inv = 1.
    endform. " FILL_COLORSTRUCT
    * FORM TOP_OF_COVERPAGE *
    form top_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading1[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_COVERPAGE *
    form end_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading2[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_TOP_OF_PAGE *
    form foreign_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading3[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_END_OF_PAGE *
    form foreign_end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading4[]
    exceptions
    others = 1.
    endform.
    * FORM LIST_MODIFY *
    *FORM LIST_MODIFY.
    * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    * EXPORTING
    * IT_LIST_COMMENTARY = HEADING5[]
    * EXCEPTIONS
    * OTHERS = 1.
    *ENDFORM.
    * FORM END_OF_PAGE *
    form end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading6[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_LIST *
    form end_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading7[]
    exceptions
    others = 1.
    endform.
    * FORM TOP_OF_LIST *
    form top_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading8[]
    exceptions
    others = 1.
    endform.
    *--- End of Program
    Reward  points  if it is usefull ..
    Girish

  • List header for alv grid using abap objects

    Hai all,
          I have displayed alv grid in container control using abap objects i.e. using method set_table_for_first_display.
    now i need to display list header for this alv grid.
    please help me how to create with a sample coding.
    Thanks and regards,
    Prabu S.

    Create a splitter using CL_GUI_EASY_SPLITTER_CONTAINER with a top and bottom half.  Put the alv grid in the bottom half.  Use cl_dd_document (documented in help.sap.com )  to build the header in the top half.  Use events on CL_GUI_ALV_GRID to handle the top-of-list printing.
    Or, if available, use CL_SALV_TABLE, and read the documentation on that.  When I needed a header for my report, that's what I did.  There's plenty of good documentation about if you'll search for it.
    matt

  • Time out error in production server  for alv grid report

    hi. i have developed alv grid report using nested select statments. when i testing in development  server it is giving the output but in production server if i give 4 months then it is showing time out error.please help me out..its urgent.
    Thanks in advance.

    Hi Manu,
    Don't use Nested selected statements.
    Use the Following  Performance Tuning Options that i have given below so that your problem can be solved.
    1)  Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
    2) Avoid for all entries in JOINS
    3) Try to avoid joins and use FOR ALL ENTRIES.
    4)   Try to restrict the joins to 1 level only ie only for tables
    5)   Avoid using Select *.
    6)   Avoid having multiple Selects from the same table in the same object.
    7)  Try to minimize the number of variables to save memory.  
    8)   The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
    9)   Avoid creation of  index as far as possible
    10) Avoid operators like  <>, > , < & like % in where clause conditions
    11) Avoid select/select single statements in loops.
    12) Try to use 'binary search' in READ internal table. Ensure table is sorted before using   BINARY SEARCH.
    13) Avoid using aggregate functions  (SUM, MAX etc) in selects ( GROUP BY , HAVING,)  
    14) Avoid using  ORDER  BY in selects
    15) Avoid Nested Selects
    16) Avoid Nested Loops of Internal Tables
    17) Try  to  use FIELD SYMBOLS.
    18) Try to avoid into Corresponding Fields of
    19) Avoid using Select  Distinct, Use DELETE ADJACENT
    <b>
    Reward Points for sure if you find it useful. </b>
    Regards
    Babu

Maybe you are looking for

  • Logging sql queries without any changes in existing apps

    Hi! Is it possible to log all SQL queries send from application to database via JDBC without any (or really small) changes in code of existing applications? I'm new to JDBC so any suggestions/ideas/best practices are welcome ;) Best regards. Edited b

  • IPad2  audio stops when screen goes to sleep

    As soon as my iPad 2's screen goes dark, the music fades out and stops. Hitting play starts it right back up. Happens the same via BT or the internal speakers. Tried killing all the apps and rebooting the iPad 2 - still happens. It's been working gre

  • Opacity

    This is related to a previous post I'm still having trouble with.  I have this code in a css file: h1 {           font-size: 40px;           font-family: Arial, Helvetica, sans-serif;           color: #000000;           border-right-style: groove;   

  • The program 'xchat' received an X Window System error. [SOLVED]

    amg ~ $ xchat The program 'xchat' received an X Window System error. This probably reflects a bug in the program. The error was 'BadImplementation (server does not implement operation)'. (Details: serial 310 error_code 17 request_code 145 minor_code

  • JVM terminated

    When I open an existing process, Workbench is being shutdown with attached message. Exit code -1073740940 Client env is - Vista 32bit // Java 1.6.0_18 // 4GB RAM What's wrong?