ALV disable row selection

Hai gurus,
In my ALV output I want to disable the left most button (Row selector) for some reasons Dynamically.
The user should not select the entire row for some condition.
loop at itab.
     If itab-field1 eq 'AA'.
         Disable row for selection.
     endif.
endloop.
Thanks in advance .....

Hi Shridhar,
I think it is difficult to have selection boxes on some condition.
We can have only one type of selection mode for alv.
Kindly refer following link for your solution
http://help.sap.com/saphelp_47x200/helpdata/en/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm
I have tried it in many ways but not able to have its solution.
Kindly share it with all of us if you get the solution.
Hope it helps,
Pratik Vora
Edited by: Pratik Vora on Feb 23, 2009 11:23 AM

Similar Messages

  • ALV - problem to disable row selection (SET_ROW_SELECTABLE)

    Hi,
    I'm using an (non editable) ALV with a supply function to display details to each line.
    I have to buttons "New" and "Modify" to insert a new line or to modify an existing row (in the details).
    This works fine.
    Now what I want to do is, if the user press one of the buttons "New" or "Modify", I want to disable the row selection of the ALV, so the user can't select another row during inserting or editing.
    For this, I've implemented in the WDDOMODIFYVIEW of the view the coding to enable or disable the row selection
    lo_value->if_salv_wd_table_settings~SET_ROW_SELECTABLE( ABAP_TRUE ).
    * or
    lo_value->if_salv_wd_table_settings~SET_ROW_SELECTABLE( ABAP_FALSE ).
    In case of "New" this works fine. The row selection is disabled.
    But not in case of "Modify".
    There is a strange behaviour:
    The row selection is not completely disabled. It looks like you can select rows, but if you select another row, it is automatically jumping to the first row and also the details is updated to the first row.
    The different between "New" and "Modify" is, that in "New", I create a new element in the ALV.
    Than it works correct. If I do the same in "Modify", I have the same correct behavior.
    But of course, I don't want to insert a new row in my "modify" mode.
    So maybe it has something todo with set lead selection?
    Maybe I do something wrong or that is a problem in the abap release. But I can't find anything in OSS.
    Thanks in advance!
    Andreas

    Hi,
    I would like to propose another approach here,
    I assume that ALV is in read only mode.
    1. User select the row and press the "Modify" button. As soon as user press the modify button "disable" the Modify and New button.
    2. Once the user is finish with the changes and press save. Enable the new and modify button.
    3. Without saving if user select anyother row then raise the "Save" confirmation popup with Yes, NO and Cancel button.
    4. If User press the New button then add new row and disable the "New" and "Modify button". Follow the Step 2 and 3 for this case also.
    I hope this will give you some idea.
    Thanks,
    Rahul

  • ALV grid row selection event

    Hi,
    I have alv grid using cl_gui_alv_grid. I want to capture the row selection event and display the detail below the table.
    how do I capture the row selection.? I want to display the details below as and when the row selection changed.
    Regards
    Panneer

    More detail example, also works with multiple selections:
    data go_alv type ref to cl_gui_alv_grid.
    data go_handler type ref to lcl_event_receiver.
    *       CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      public section.
        methods delayed_change_select
                for event delayed_changed_sel_callback of cl_gui_alv_grid.
    endclass.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    class lcl_event_receiver implementation.
      method delayed_change_select.
        message 'Selection changed' type 'S'.
      endmethod.                    "delayed_change_selection
    endclass.                    "lcl_event_receiver IMPLEMENTATION
    *&      Module  STATUS_0100  OUTPUT
    module status_0100 output.
      data lt_fcat_lvc type lvc_t_fcat.
      data lt_fcat_alv type slis_t_fieldcat_alv.
      data ls_layo type lvc_s_layo.
      set pf-status 'MAIN'.
      if go_alv is initial.
        ls_layo-sel_mode = 'A'.
    *   ls_layo-sel_mode = 'B'.    "Also works
    *   ls_layo-sel_mode = 'C'.    "Also works
    *   ls_layo-sel_mode = 'D'.    "Also works
        call method go_alv->set_table_for_first_display
          exporting
            is_layout       = ls_layo
          changing
            it_fieldcatalog = lt_fcat_lvc
            it_outtab       = gt_data[].
        create object go_handler.
        set handler go_handler->delayed_change_select for go_alv.
        call method go_alv->register_delayed_event
          exporting
            i_event_id = cl_gui_alv_grid=>mc_evt_delayed_change_select.
      endif.
    endmodule.                 " STATUS_0100  OUTPUT

  • ALV Without Row Selection

    Good Morning,
    I've created a report using <b>REUSE_ALV_GRID_DISPLAY</b>.
    I want to exclude de boxes for row selection in the left of the grid, how can i do that?
    This should be basic...
    Best Regards,
    Pedro Gaspar

    Hi Pedro,
    try this:
      DATA:   EXCLUDING  TYPE SLIS_T_EXTAB.
      DATA: WA_EXCLUDING TYPE SLIS_EXTAB.
      WA_EXCLUDING-FCODE = '&ETA'.
      APPEND WA_EXCLUDING TO P_EXCLUDING.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
                 I_CALLBACK_PROGRAM       = PROGNAME
              I_CALLBACK_PF_STATUS_SET = 'MAIN'
                 I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
                 I_CALLBACK_TOP_OF_PAGE   = 'TOP_OF_PAGE'
                 IS_VARIANT               = VARIANT
                 IS_LAYOUT                = LAYOUT
                 IT_FIELDCAT              = FIELDCAT
                 IT_EXCLUDING             = EXCLUDING
                 IT_SORT                  = SORT
                 IT_FILTER                = FILTER
                 I_SAVE                   = 'A'
                 IT_EVENTS                = EVENTS
                 IT_EVENT_EXIT            = EVENT_EXIT
                 IS_PRINT                 = PRINT
            TABLES
                 T_OUTTAB                = ITAB
            EXCEPTIONS
                 PROGRAM_ERROR            = 1
                 OTHERS                   = 2.
    Regards, Dieter

  • ALV Grid row selection possible options

    Hello Experts,
    I have an ALV Grid output with rows color codes based on certain status for each rows.Now when the user selects one or more lines to do the next process, what happens now as sap standard is the selected lines becomes highlighted ( kind of yellowish) and the selection button gets pressed.
    But what the user is requesting is ,lets say he selects one blue and another red line, then both becomes yellow (because of the SAP standard highlighting) ...he would like those line colors to be still red and blue and only the selection button pressed.
    Is there a way to do that is ALV grid? I'm trying to convince him to look at the status colum if he gets confused with what colors he selected or I will have to use a checkbox field as the first column and and hide the ALV selection option.
    But was curious to find if this is possible in ALV?Or any other suggestions to handle this requirement is welcome.
    Mat

    Hi Mat,
    I am curious if your user is so arogant when he buys a car too. Does he say to dealer "Sorry I don't want this gear lever to be placed here and here, I want it a litte bit higher. Can you please fix that?". This sounds like you are struggling with dumb user. I have never heard of someone complaining that the standard highlight is in wrong color. You already provided to him row colors, right? I think most of the users would be hugging you for such facilities.
    I think in your case as the user is inalterable you should go for the checkboxes as you say. This way maybe you will somehow satisfy his needs (as the row colors will be kept even during selection). Personally I wouldn't bother such requirements. As long as the program reports correct data, he should not complain at all.
    Good luck then
    Marcin

  • Can i raise any event on the ALV  GRID row selection.

    Hi All ,
            Is there any way to trigger any event upon the selction of the ALV <b>GRID</b> rows?
    Suppose i have 2 grid controls  1 for Header and the other for corresponding line items . I would have already the header data (differnt document headers)  populated , upon selecting (i don't want any user click or button click) one of the header i want to do some changes to the corresponding line times for the header data selected...
    Please give me some tips on how to  go about on this .
    Thanks,
    ALFH

    <b>upon selecting ?</b>
    how the user will select , since you dont want user click or button click?
    one option is to have hotspot, but again user has to click .
    Regards
    Raja

  • Alv colour row select first row

    Hi. I hava an alv with colour in some rows. When i want to select another row distint the first, it always goes to de first row and it doesn't allow me select other row.
    how can i solve this to select for example the third row.
    thanks.

    Hi,
    Are you programatically setting the selection of the ALV row anywhere in your program? This might happen if you set the lead selection of the node in the WDDOMODIFYVIEW method of your view. Can you please check that ? Also you can try changing the selection mode of your ALV:
    lo_config_model_value = lo_interfacecontroller->get_model( ).
    lo_config_model_value->IF_SALV_WD_TABLE_SETTINGS~SET_SELECTION_MODE(CL_WD_TABLE=>E_SELECTION_MODE-AUTO).
    Best Rgds,
    Viqar.

  • Disable row selection for certain column in JTable

    I have a JTable with several columns, one of which contains an "Info" button. I already have it worked out that when I click on the "Info" button, that event gets passed from the JTable to the button. I have multi-select enabled for the JTable, but I don't want clicking on the "Info" button to change the current selection. I have a klugy "fix" working where I save off the current selection, and then restore it after the user presses the "Info" button. However, this results in "flashing" - the row containing the selected "Info" button becomes selected briefly, then the original selection is restored. How can I avoid this? I would like to just ignore selection events on the "Info" column, but still pass the mouse click event through to the button.
    Any suggestions?

    try this
            JTable table = new JTable() {
                public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
                    if (!getColumnModel().getColumn(columnIndex).getIdentifier().equals("Info")) {
                        super.changeSelection(rowIndex, columnIndex, toggle, extend);
                    }//else

  • Sorting JTab disables row selection

    In a scroll panel I inserted a Jtable that shows view data. Sorting works by double-clicking the column header. After sorting however rows cannot be selected, sometimes the table gets reorganized again.
    How can I allow a row to be selected after sorting as described above?
    Thank you.

    This is the way the sort model was designed. I filed an enahncement request.
    Frank

  • Row Selection in ALV on Single click

    Hi
    Can we read the row in ALV on row selection ?  i set  gs_layout-sel_mode = 'D'.
    My Scenario is as under
    there is an ALV on the screen in which i have displayed the data . there is a push button on the screen. User will select the row and then click the push button. on click of that push button selected row should move to the work area.
    I am using  following method
    CALL METHOD g_Grid->SET_TABLE_FOR_FIRST_DISPLAY
    Regards
    Ammad

    If the method [g_grid->get_selected_rows|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b55312d30911d2b467006094192fe3/frameset.htm] returns no row, then try a [g_grid->get_current_cell|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b552fad30911d2b467006094192fe3/frameset.htm]  (Don't forget the [cl_gui_cfw=>flush|http://help.sap.com/saphelp_erp2004/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/frameset.htm] to synchronize the automation queue.)
    Regards,
    Raymond

  • Jtable - disable mouse selection

    hello,
    i did like to disable row selection in a jtable by mouse.
    in fact, the user should not be able to select rows in the table, but programmatily it should work.
    any ideas?
    thank you
    greets
    lukas

    You could try removing all the MouseListeners from the table. I don't know what other functionality you would lose.
    MouseListener[] listeners = (MouseListener[])table.getListeners(MouseListener.class);
    for (int i = 0; i < listeners.length; i++)
         table.removeMouseListener( listeners[i] );

  • ALV Grid multiple row selection, disabling some

    Does anyone know if it is possible to have an ALV grid with multiple row selection allowed but for some rows the row selection is disabled?
    Kind regards,
    John.

    Hi John,
    You can add a check box and select multiple rows. I am using the same technique. I have used OO.
    a) Use Even handler "Double Click"
    b)Using "SELECT_ALL_ENTRIES  CHANGING PT_OUTTAB TYPE STANDARD TABLE" and I am sorting based Check box selection.
    Need more help please let me know. I will send you the code.
    Lanka
    Message was edited by: Lanka Murthy

  • How to disable line selection functionality in ALV.

    Hallo guys,
    I need to disable the ALV functionality to select one(or more) lines.
    How to hide this push button on the right side?
    Thanks.

    hi
    good
    check this
    *& Report  ZDEMO_ALVGRID_SELROW                                        *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display capture each row a user has *
    *& selected                                                            *
    REPORT  zdemo_alvgrid_selrow                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      SEl,                         "stores which row user has selected
      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,
    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.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = '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.
      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-do_sum      = 'X'.        "Display column total
      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
          Build layout for ALV grid report
    form build_layout.
      gd_layout-box_fieldname     = 'SEL'.
                                     "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           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  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into corresponding fields of table it_ekko.
    endform.                    " DATA_RETRIEVAL
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
        WHEN '&DATA_SAVE'.  "user presses SAVE
        loop at it_ekko into wa_ekko.
          if wa_ekko-sel EQ 'X'.
          Process records that have been selected
          endif.
        endloop.
      ENDCASE.
    ENDFORM.
    thanks
    mrutyun^

  • Cell(Row) Selection not display in OOPS ALV

    Hi all,
    I am not able to get the cell(row) selection in the oops ALV when i called it second time.
    I am displaying some information using oops alv  in 100 screen. After user action on 100 screen i am calling 200 screen with different information which is also display in oops alv. When i displaying information in second time the cell(row) selection is not getting displayed.
    For both ALV the fieldcatelog is different.
    Initially i tried using same container but i face same problem, so i am trying to call second alv in new screen.
    But problem remain same.
    Can anyone help me to solve this problem ?
    Regards
    Nilesh

    hi,
    can u send ur report  so dat i can look furhter to it.and help u out

  • How to make the first row  selected before the display of ALV grid

    Hello Experts,
    I created a ALV grid using custom container in a screen . Now i want do the follwing:
    1. i want that, the  <b>first line must be selected before the display of ALV.</b>
    2. I have selection buttons . But i dont want the multiselect button and the  
        standard  toolbar in the ALV grid.
    Could any one please help me regarding the above?
    Thanks & Regards
    Sudhansu

    can u pls explain in more details with an example?
    I am telling u the scenario.
    1. i have a screen(Modal dialog Box)  containing ALV grid with selection buttons for each row  (top part) and a subscreen(second part).
          Now when i click on a selection button, it will display the corresponding values in the subscreen.
        When this screen will display for the first time , then first row of the ALV grid should be selected and the corresponding values should be displayed in  the subscreen.
    i   wrote the following code in the PAI. But when i select a record its not triggering the PAI.
    DATA:
         gi_index_rows TYPE lvc_t_row, " Internal table for indexes of selected rows
         g_selected_row LIKE lvc_s_row, " Information about 1 row
         l_lines TYPE i.
      CLEAR g_wa_vdmeko.
    *get selected row
      CALL METHOD g_alv_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      LOOP AT gi_index_rows INTO g_selected_row.
        READ TABLE g_int_vdmeko INDEX g_selected_row-index INTO g_wa_vdmeko.
        SELECT SINGLE  *
               FROM vdmepov
               WHERE bukrs = g_wa_vdmeko-bukrs AND
                     styp  = g_wa_vdmeko-styp  AND
                     sbez  = g_wa_vdmeko-sbez  AND
                     svym  = g_wa_vdmeko-svym  AND
                     svnr  = g_wa_vdmeko-svnr.
      ENDLOOP.
    I am displayinng the ALV using method "set_alv_for_first_display".
    Please help if u have any idea..................
    Thanks
    Sudhansu

Maybe you are looking for