Multiple selection of  e_ucomm in ALV Grid toolbar

Dear SAP friends,
I have created HR report.
On the selection screen the User enters some initial data  and ALV Grid get displayed.
In event Handle_toolbar the program adds a custom button to standard ALV grid toolbar named "ABSENCE/ATTENDANCE".
In event handle_menu_button the program adds functions to this button.
Then in event handle_user_command depending on the function selected "e_ucomm" the program repopulates the ALV Grid.
METHOD handle_toolbar.
* Append a separator to standard toolbar
    CLEAR gs_toolbar.
    gs_toolbar-butn_type = 3.
    APPEND gs_toolbar TO e_object->mt_toolbar.
    CLEAR gs_toolbar.
    gs_toolbar-function  = 'ABSENCE/ATTENDANCE'.
    gs_toolbar-icon      = icon_position_hr.
    gs_toolbar-quickinfo = 'Absence/Attendance Type'.
    gs_toolbar-butn_type = 2.               " 2-Menu type, 0-single button type
    gs_toolbar-disabled  = space.
    APPEND gs_toolbar TO e_object->mt_toolbar.
  ENDMETHOD.                    "handle_toolbar
  METHOD handle_menu_button.
* Handle own menubuttons
    IF e_ucomm = 'ABSENCE/ATTENDANCE'.
     LOOP AT it_aa INTO it_aa_ln.
       MOVE it_aa_ln-type TO w-fcode.
      CONCATENATE   it_aa_ln-type '=' it_aa_ln-text
        INTO w-text
          SEPARATED BY SPACE.
      CALL METHOD e_object->add_function
        EXPORTING
          fcode = w-fcode
          text  = w-text.
     ENDLOOP.
    ENDIF.
  ENDMETHOD.                    "handle_menu_button
  METHOD handle_user_command.
    MOVE e_ucomm TO w-abstype.
    PERFORM abs_att USING w-abstype.
  ENDMETHOD.                    "handle_user_command
Is there a way to select more than one line or e_ucomm in other words at a time?
I would like to give my user a choice of let's say one report with three types of absences at a time rather than three reports with one type each.
Thanks,
Tatyana

The whole point of a toolbar button is to do a specific function.
What I would actually do here is in your menu button add another option say "User Choice" and when this is clicked throw up another screen say  another ALV grid where the user can choose the various combinations  or do it via a POPUP. A second grid IMO would be the best way to do it as the user can select easily specific rows.
You can either display the 2nd grid in a 2nd custom container on your main screen where you are showing the ALV grid or pass control  to a new screen / program.  Using a 2nd container is better as you still will have your instance of the original grid available.
Cheers
Jimbo

Similar Messages

  • Multiple Selection on Matchcode in ALV Grid

    I need to implement a Matchcode with multiple selection on a Field in an ALV Grid. On F4 in this specific Field the specific matchcode muss be enable with multiple selection. And after multiple selection by the user, the result muss be concatenate and insert to this field.
    Any suggestions or code?
    Thanks and Best Regards
    Franck

    Check the program: BCALV_TEST_GRID_F4_HELP.
    IN the code, search foor the fm: F4IF_FIELD_VALUE_REQUEST.
    You should pass the parameter MULTIPLE_CHOICE = 'X' for multiple choice in the F4 pop up.
    Once you get the returned table, you can concatenate the result and put it it the target field.
    Regards,
    Ravi

  • Multiple selection in DISPLAY only ALV GRID

    Hi,
    I would like to make the rows of the ALV Grid Display only at the same time I would like to make multiple selection possible.
    Multiple selection is possible by giving EDIT = 'X' at the layout level. But then if we give EDIT = ' ' at the fieldcatalogue level or no_input = 'X' at the layout level it is still in Editable mode. Kindly help me.
    Thanks

    Hi,
    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
    Data declaration:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
            exporting
              it_index_rows = gi_index_rows.
      ENDIF.
    Make an Exception field ( = Traffic lights)
    There can be defined a column in the grid for display of traffic lights. This field is of type Char 1, and can contain the following values:
    1 Red
    2 Yellow
    3 Green
    The name of the traffic light field is supplied inh the gs_layout-excp_fname used by method set_table_for_first_display.
    Example
    TYPES: BEGIN OF st_sflight.
            INCLUDE STRUCTURE zsflight.
    TYPES:  traffic_light TYPE c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
      Set the exception field of the table
        LOOP AT gi_sflight INTO g_wa_sflight.
          IF g_wa_sflight-paymentsum < 100000.
            g_wa_sflight-traffic_light = '1'.
          ELSEIF g_wa_sflight-paymentsum => 100000 AND
                 g_wa_sflight-paymentsum < 1000000.
            g_wa_sflight-traffic_light = '2'.
          ELSE.
            g_wa_sflight-traffic_light = '3'.
          ENDIF.
          MODIFY gi_sflight FROM g_wa_sflight.
        ENDLOOP.
      Name of the exception field (Traffic light field)
        gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
      Grid setup for first display
        CALL METHOD go_grid->set_table_for_first_display
          EXPORTING i_structure_name = 'SFLIGHT'
                                  is_layout               = gs_layout
          CHANGING  it_outtab                 = gi_sflight.
    Color a line
    The steps for coloring a line i the grid is much the same as making a traffic light.
    To color a line the structure of the  table must include a  Char 4 field  for color properties
    TYPES: BEGIN OF st_sflight.
            INCLUDE STRUCTURE zsflight.
          Field for line color
    types:  line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    Loop trough the table to set the color properties of each line. The color properties field is
    Char 4 and the characters is set as follows:
    Char 1 = C = This is a color property
    Char 2 = 6 = Color code (1 - 7)
    Char 3 = Intensified on/of = 1 = on
    Char 4 = Inverse display = 0 = of
         LOOP AT gi_sflight INTO g_wa_sflight.
          IF g_wa_sflight-paymentsum < 100000.
            g_wa_sflight-line_color    = 'C610'.
          ENDIF.
          MODIFY gi_sflight FROM g_wa_sflight.
        ENDLOOP.
    Name of the color field
    gs_layout-info_fname = 'LINE_COLOR'.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
          EXPORTING i_structure_name = 'SFLIGHT'
                                 is_layout                = gs_layout
          CHANGING  it_outtab                 = gi_sflight.
    Refresh grid display
    Use the grid method REFRESH_TABLE_DISPLAY
    Example:
    CALL METHOD go_grid->refresh_table_display.
    ALV Grid Control with column and row selection
    Selecting and Deselecting Rows
    Use
    Depending on where the ALV grid control is used, there are various methods for selecting and deselecting cells and rows:
    If no pushbuttons are displayed on the left edge of the list:
    You can only select one row at a time.
    You can select multiple rows.
    If pushbuttons are displayed on the left edge of the list:
    You can select several rows or individual cells.
    You can select several rows as well as several cells or individual cells.
    Procedure
    If no pushbuttons are displayed on the left edge of the list, you select a row by clicking an entry in the row.
    If pushbuttons are displayed on the left edge of the list, you select a row by clicking the pushbutton on the relevant row.
    In this case, you select the relevant cell by selecting the entry in the row.
    In both cases:
    To select several rows, press the Shift button and choose the cells as described above.
    Adjacent rows:
    Select a row, choose Shift or Control, and select the desired rows,
    or
    Choose Shift, and select the first and the last of the desired rows,
    or
    Select a row, keep the mouse button pressed, and pass over the desired rows.
    Rows that are not adjacent:
    Select a row, choose Control, and select the desired rows.
    All rows:
    You can only select all rows at once if pushbuttons are displayed on the left side of your list. To select all rows, choose .
    To deselect individual rows, press the Ctrl button and click the relevant row.
    Result
    The selected cells have an orange background. The position of your cursor is indicated with a yellow background.

  • How can I trigger a USER_COMMAND for alv grid "toolbar" ???

    Hi,
    i have the standard ALV Grid "toolbar" and if i click to the Button "&LOCAL&COPY_ROW" than i want try to make a Refresh to my ALV Table in the Event "afteruser_command"_!!!!
    Here is the implementation of my Event *"afteruser_command":*_
    METHOD on_after_user_command.
    ........DATA: ls_stable TYPE lvc_s_stbl.
    .....CASE e_ucomm.
    .....WHEN '&LOCAL&COPY_ROW'.
    ........MESSAGE 'LOCAL_COPY_ROW' TYPE 'S' DISPLAY LIKE 'E'.
    ........ls_stable-row = 'X'.
    ........ls_stable-col = 'X'.
    ........CALL METHOD gr_grid_d0100->refresh_table_display
    ..............EXPORTING
    .......................is_stable      = ls_stable
    ..............EXCEPTIONS
    .......................finished       = 1
    .......................OTHERS         = 2.
    ......ENDCASE.
      ENDMETHOD.   
    But it doesnt work.
    Is there another function code for the Copy Button????
    Thanks
    Ersin

    Hello Ersin,
    the events "after_user_command", "before_user_command" and "user_command" will not be fired when selecting this command!
    In my opinion, there is no solution, to fire these events, using this alv-function!
    But there is a trick:
    1. Register on the event "toolbar" with an own method:
          toolbar_own          for event toolbar of cl_gui_alv_grid
                                       importing e_object
                                              e_interactive,
    In this method change the function code of "&LOCAL&COPY_ROW", but don´t change the row of the entry, because the button should appear on the same place in the toolbar:
        field-symbols: <ls_toolbar>  type stb_button.
        read table e_object->mt_toolbar with key function = '&LOCAL&COPY_ROW'
                                        assigning <ls_toolbar>.
        if sy-subrc = 0.
          <ls_toolbar>-function = 'COPYROW_OWN'.
        endif.
    2. Register on the event "user_command" ( I think, that´s clear ):
          user_cmd_own           for event user_command
                                              of cl_gui_alv_grid
                                              importing e_ucomm,
    ( don´t forget the set handler-commands for both events:
      set handler po_alv_own->user_cmd_own              for po_alv_own.
      set handler po_alv_own->toolbar_own               for po_alv_own.     )
    3. Now you can react in the method "user_command" on your own function code:
        case e_ucomm.
          when 'COPYROW_OWN'.
            perform copy_row using    me
                             changing gt_bis_cf_out.
    Sample code for copying the current line:
    FORM COPY_ROW  using    po_alv_own          type ref to gcl_alv_own
                   changing pt_table_alv      type gt_table_alv_t.
      data: l_index         type i,
            ls_table_alv   type gs_table_alvt_t.
      call method po_alv_own->get_current_cell
         importing
           e_row     = l_index.
    *      e_value   =
    *      e_col     =
    *      es_row_id =
    *      es_col_id =
    *      es_row_no =
      "read the current line:
      read table pt_table_alv index l_index
                               into ls_table_alv_out.
      "some changes for the new row:
      clear: ls_table_alv-style,
             ls_table_alv-tabix.
      "insert the new line:
      add 1 to l_index.
      insert ls_table_alv into pt_table_alv index l_index.
      po_alv_own->refresh( ).
    ENDFORM.                    " COPY_ROW
    In this manner the events "after_user_command", "before_user_command" are fired, too!
    For information: My problem was, that the ALV-function copied the style-information too, so in the new line, some fields are not editable. At least his field must be cleared!
    Best regard
    Thomas Scheuermann

  • Anything other than buttons on ALV Grid toolbar?

    Does anyone know if anything other than buttons can be placed on a ALV Grid toolbar, eg. a piece of text or an input field? The filter button for data selection may be too cumbersome/slow for a call centre operator; I want to have a display field with a dropdown identifying a data field and an input field to accept a value on which to select.

    may be you can do some thing like this..instead of having a input field on the toolbar. have an input field above the ALV grid(this is applicable only when you are using Object Oriented ALV).
    | input field : ________________   |
    |__________________________________|
    | ALV GRID OUTPUT                  |
    |__________________________________|
    you can have a button along with input field also. enter the value in it, and press enter . in the enter handling fetch all the data. and display in the ALV grid.
    in the screen fiest create input field, and button, then place the custom control. on the custom control you place the grid.

  • How to apply List box for multiple selection of rows  in ALV report ?

    Hi Exprots,
    1: How to apply List box for multiple selection of rows  in ALV report ?
    Thanking you.
    Subash

    hi,
    check the below program.
    REPORT zalv_dropdowns.
    *Type pools declarations for ALV
    TYPE-POOLS : slis.
    *data declarations for ALV container,ALV grid, Fieldcatalogues & layout
    DATA: g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
    DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
          wa_outtab TYPE t517a.
    START-OF-SELECTION.*Call to ALV
      CALL SCREEN 600.*On this statement double click  it takes you to the screen painter SE51.
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    Here we also call the subroutine for ALV output.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    ENDMODULE.                    "pai INPUT
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    *Build the field catalogue
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'T517A'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    To assign dropdown in the fieldcataogue
      LOOP AT gt_fieldcat INTO ls_fcat.   
    CASE ls_fcat-fieldname.
       WHEN 'SLART'.
    *is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    is the second list box    
    WHEN 'ABART'.       
            ls_fcat-drdn_hndl = '2'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.   
    ENDCASE.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  ALV_OUTPUT
    FORM alv_output .*Create object for container
      CREATE OBJECT g_custom_container
             EXPORTING container_name = 'CCONT'.
    *create object for grid
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Build fieldcat and set column
    *Assign a handle for the dropdown listbox.
      PERFORM build_fieldcat.
    *Build layout
      PERFORM build_layout.
    Define a drop down table.
      PERFORM dropdown_table.
    *fetch values from the T517A table
      SELECT * FROM t517a INTO TABLE gt_outtab.
    *Display ALV output
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = gt_outtab.ENDFORM.                               "ALV_OUTPUT
    *&      Form  dropdown_table
          text
    -->  p1        text
    <--  p2        text
    FORM dropdown_table.*Declarations for drop down lists in ALV.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
    First SLART listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 Primary school'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 Lower Secondary'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '03 Upper Secondary'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '04 Professional School'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '05 College'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '06 University'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '09 Other Establishment'.
      APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2').  ls_dropdown-handle = '2'.
      ls_dropdown-value = '10 Primary School certificate'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '20 Lower secondary/Junior high'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '30 High school diploma(B-levels)'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '31 Vocational'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '32 Matriculation'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '40 Specialist vocational certificate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '50 College degree Level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '51 College degree Level2'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '52 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '60 Univ Degree level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '61 Bachelors degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '62 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '63 Licenciate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '64 Doctors Degree Ph.D'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '89 None'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '90 Unknown'.
      APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.ENDFORM.                               " dropdown_table
    *&      Form  build_layout
          text
    *layout for ALV output
    FORM build_layout .  gs_layout-cwidth_opt = 'X'.
      gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
      gs_layout-no_toolbar = 'X'.ENDFORM.                    " build_layout
    endform.
    Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM

  • Multiple Lines in a Single ALV Grid Cell

    Is there any way to Display Multiple Lines in a Single ALV Grid Cell.
    This can be accomplished by Sorting the First 3 fields and Make it Looks like below displayed format.
    But My problem is while downloading also it should be Displayed in the same format.
    All inputs are highly appreciated.

    there was a post similar to this some days back... search it..
    any ways...
    what u can do is...
    arrange ur final internal table so that it will look like same line...
    like...lets say ur internal table is :
    A1 B1 C1 D1 123
    A1 B1 C2 D2 123
    A1 B2 C1 D1 123
    A1 B2 C2 D2 123
    and u can rearrange ur table to be like
    A1 B1 C1 D1 123
          C2 D2 123
    A1 B2 C1 D1 123
          C2 D2 123
    what i mean to say is dont pass the fields if they are same in the previous line... try it out..
    and then pass it two ur ALV.
    it will look like they are in one line
    Edited by: soumya prakash mishra on Jun 17, 2009 1:31 PM

  • Change Layout in Selection Screen for OO ALV-Grid

    Hello everyone,
    I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
    (1) I got my parameter for layout
    PARAMETER: p_vari  TYPE disvariant-variant.
    (2) I fill my global layout structure in initialization
    INITIALIZATION.
    * Variante vorbelegen
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ENDIF.
    (3) I got my handling for F4-value help on variant parameter
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
       CALL FUNCTION 'LVC_VARIANT_F4'
         EXPORTING
           is_variant    = gs_variant
           i_save        = 'A'
         IMPORTING
           es_variant    = gs_variant
         EXCEPTIONS
           not_found     = 1
           program_error = 2
           OTHERS        = 3.
       IF sy-subrc <> 0.
         MESSAGE text-m01 TYPE 'S'.
       ELSE.
         p_vari = gs_variant-variant.
       ENDIF.
    (4) I give back my parameters content into the variant structure at start of selection
    START-OF-SELECTION.
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
       gs_variant-variant  = p_vari.
    This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
    When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
    So what to do? :-)
    Regards
    Michael

    Wow that was fast, works great, thanks :-)
    I did not use this parameter in set table method but now I fill it dynamically.
    Ok next problem, one step harder ;-)
    Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
    Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
    This works fine when using it in selection screen output.
    AT SELECTION-SCREEN OUTPUT.
       CLEAR gs_variant.
    * Layout-Handles individuell für Klausel-Radiobuttons setzen
       IF     p_py IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLPY'.
       ELSEIF p_rh IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLRH'.
       ELSEIF p_aj IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLAJ'.
       ELSEIF p_sr IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLSR'.
       ENDIF.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ELSE.
         CLEAR p_vari.
       ENDIF.
    But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically.

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • Select single row in ALV grid

    ABAPer's ,
    Does anyone can guide me to select single row only in ALV grid , without OO.

    Hello,
    I did not get u.
    But check the below code it may help u.
    tables: mara.
    TYPE-POOLS: SLIS.
    data:repid like sy-repid.
    data: itb type mara occurs 0 with header line,
    IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV WITH HEADER LINE,
    IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
    ITB1 TYPE MAKT OCCURS 0 WITH HEADER LINE.
    selection-screen begin of block b.
    parameters: p_matnr type matnr.
    selection-screen end of block b.
    select * from mara into table itb where matnr = p_matnr.
    SELECT * FROM MAKT INTO TABLE ITB1 WHERE MATNR = P_MATNR.
    repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
       I_CALLBACK_PROGRAM             = repid
      I_CALLBACK_PF_STATUS_SET       = ' '
       I_CALLBACK_USER_COMMAND        = 'HANDLE_USER_COMMAND'
       I_STRUCTURE_NAME               = 'MARA'
       IS_LAYOUT                      = IT_LAYOUT
       IT_FIELDCAT                    = IT_FIELDCAT[]
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      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                       = itb
    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.
    FORM HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
    SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    CLEAR IT_FIELDCAT[].
    IF RS_SELFIELD-FIELDNAME = 'MATNR'.
    READ TABLE ITB1 INDEX RS_SELFIELD-TABINDEX.
    WRITE: / ITB1-MAKTX.
    ENDIF.
    ENDCASE.
    ENDFORM. "HANDLE_USER_COMMAND
    Regards

  • ALV grid toolbar - standard download to excel error

    Hi Experts,
    In my ALV grid report,  when i click on the standard ALV toolbar to download the output to excel file, the data gets downloaded fine execpt for one field called serial number. It is of size 18 chars.
    The last number on this field is getting truncated when it is downloaded to excel. Only 17 characters is being shown. There is no output lenght specification in the field catalog. The column width optimize property is also not set. Any ideas on what might be the problem?
    Cheers

    Hi,
    Check this link:
    Re: Digit missing in the alv export
    Hope this helps.
    Regards,
    Satish Kanteti

  • How to disable multiple select option in OO ALV.?

    I want to display an ALV with the multiple select button disabled.I want the "select" button at the start of each row but  the "select all/deselect all" button at the right hand top corner of the display be
    disabled.
    Please help me out.

    Hi
    You can add a new column to your internal table for the selection field.
    After registering the required events, for eg:
    METHOD alv_set_events.
      DATA: lr_events TYPE REF TO cl_salv_events_table.
      lr_events = mcn_alv->get_event( ).
    *- Register the event Double click
      SET HANDLER me->mt_on_double_click FOR lr_events.
    *- Register the event User command
      SET HANDLER me->mt_on_user_command FOR lr_events.
    ENDMETHOD.
    you can process the selected records and mark them as "Processed" by setting a color to the record.
    DATA: BEGIN OF lw_farb ,                  " Farbstruktur für ALV
            farb1(1) VALUE 'C',
            farb2(1),
            farb3(1) VALUE '0'.
      DATA: END OF lw_farb.
    DATA: lf_col_bearbeiten      TYPE i VALUE 5.
      lw_farb-farb2 = lf_col.
      ef_col = lw_farb.
    Regards
    Raj

  • Visibility of ALV grid toolbar functions of the Custom report in ITS screen

    Hi all,
    I am working on SRM 5.0  with INTERNAL ITS.I have  created a custom report and a transaction code  for the same.Now in the SRM Web menu,I have provided a link for this report.
    The problem I am facing is that in the O/P screen of the report,I have an ALV grid being displayed with 1 custom icon at the end of the std ALV toolbar.Now in the SAPGUI,this icon is displayed correctly at the end of the ALV toolbar but in the Web screen,i can see only few of the functions(visible as buttons in the SRM web screen/IE)  in the ALV toolbar and rest of them being displayed under an additional button "MORE".Is there any way i can show the custom icon as a button which is directly visible on the SRM web screen and not under the  options MORE?
    All inputs will be  highly appreciated and rewarded.

    Hello!
    There are several possibilities how to call transaction:
    - You can call it as service (that is what you do when you test it from SICF)
    - You can call it through service (or alias) WEBGUI (not using service for the specific transaction to call it)
    If you are calling it through WEBGUI then parameter ~SINGLETRANSACTION should be added to service (or alias) of WEBGUI. And there should be added also Log Off URL (in SICF). At this case it should navigate back to the URL which is specified in SICF.
    Hope this helps!
    Best regards,
    Rorijs

  • Printing Selection-Screen while printing ALV Grid output display

    Hi,
    I have a requirement wherein I want to print the Selection Screen also while printing the output in simple ALV grid Display.
    Currently when I print the ALV output report, only the header and the Body of the ALV is getting printed. But the requirement is that I also want to print Selection screen along with this.
    If anyone has faced a similar situation, plz let me know what needs to be done in order to print the selection screen also while printing the ALV report output.
    Rgds,
    Nitin

    Hi,
    You can use given function module to print your
    selection screen
    RS_REFRESH_FROM_SELECTOPTIONS
    >This will get Current contents of selection screen
    RS_LIST_SELECTION_TABLE
    >This will Generates list according to values in selection table(RSPARAMS)
    Sample
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
           EXPORTING
                curr_report     = p_repid
           TABLES
                selection_table = it_int_tab
           EXCEPTIONS
                not_found       = 1
                no_report       = 2
                OTHERS          = 3.
      IF sy-subrc EQ 0.
        WRITE:1  'Selection Criteria'(i19),
             /1  sy-uline(18),
             /1  'Variant Name'(i21),
             23  sy-slset.
    *--  This function module lists the Selection Screen contents
        CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
             EXPORTING
                  report        = p_repid
                  seltext       = 'X'
                  newpage       = space
             TABLES
                  sel_tab       = it_int_tab
             EXCEPTIONS
                  sel_tab_empty = 1
                  OTHERS        = 2.
    Mark all helpful answers

  • Delete row in OO ALV grid toolbar

    Hello;
    I am using OO ALV grid to display data. On the standard toolbar when delete row button is activated the relevant row is removed from the screen. The program catches this event only when Enter is pressed. Is it possible to catch it as soon as delete row is pressed?
    Thx in advance.
    Ali

    Hi Ali,
            You have to handle standard ALV toolbar. Even you can use Custom Toolbar. But you can handle it from Standard toolbar user command. Register events..
    Thanks and Regards,
    Sampath

Maybe you are looking for

  • Badi or User Exit to close PR in ME59n

    Dear All, I have implemented a enhancement for ME59n(EXIT_SAPLME59_001). Here we club the PR which has same material, vendor, date..... And add the quantity to first PR quantity and create a single PO against all the PR. PR No              Material  

  • +/- buttons stopped working in Project 2010

    I'm running Project Pro 2010 on a Windows 7 laptop, but not connected to a server. This morning when I came in an opened up my project I couldn't show subtasks in my project by clicking on the + sign in front of the summary task. The cursor was a out

  • How to import photos and keep album structure?

    Hi all - I had to do a clean install of OS X, but beforehand, I backed up my entire hard drive using Super Duper. Now, I want to import all of my photos back into iPhoto, but is there a way for me to do this and keep the previous album structure that

  • Convert pages document to epub document

    Prior to Lion I was able to convert a Pages document to an epub book quite simply.  The option to convert to an epub book is no longer available.  I see that I am supposed to be able to do this with automator.  I do not understand why such a simple p

  • ERP Integrator Source Informations

    Hi All, I would like to know whether ERP Integrator will support the External feed file(from any other source system) to Hyperion Applications. ERP Integrator will support all ORACLE ERP & HR Modules, but in terms of external system likes Customized