Disable the checkbox of rows in ALV

Moderator message: please do not post the same question in more than one forum. Duplicate deleted
Hello,
For example we have an internal table containing the data of table RESB. The alv grid that will display this data will have a checkbox in its first column. If for example the internal table contains two reservations with two line items each, only the checkbox of the first two line items will be enabled. the rest will be grayed out. How can we do that?
Hope you can help us. Thanks!
Edited by: Matt on Jan 13, 2009 8:11 AM

see this thread
ALV checkbox  - disable
http://www.sapfans.com/forums/viewtopic.php?t=88376
see this sap help too
http://help.sap.com/saphelp_nw04/helpdata/en/26/46fb40f17af66fe10000000a1550b0/content.htm

Similar Messages

  • How to change the colour of row in ALV depending on condition?

    Hi All,
    I want to change the color(from green to red )of perticular row in ALV depending on certain conditions like if amount in some field in row is more than 5000.
    Can anybody please tell me how to do that?
    expecting early reply.
    Thanks in advance,
    Rohini.

    Hi
    Check this sample report
    *& Report  ZALVCOLOR                                                   *
    REPORT  ZALVCOLOR                               .
    DATA : mara TYPE mara.                 " General Material Data
    TYPE-POOLS: slis.                      " ALV Global types
    FIELD-SYMBOLS :
      <data> TYPE table.                   " Data to display
    SELECT-OPTIONS :
      s_matnr FOR mara-matnr.              " Material number
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.    "#EC NEEDED
    PARAMETERS p_max(2) TYPE n DEFAULT '50' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    INITIALIZATION.
      v_1 = 'Maximum of lines to display'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
    *      Form  f_read_data
    FORM f_read_data.
      FIELD-SYMBOLS :
        <field>    TYPE ANY,
        <field2>   TYPE ANY,
        <header>   TYPE ANY,
        <header2>  TYPE ANY,
        <lt_data>  TYPE table.             " Data read from DB
      DATA:
        lp_struct  TYPE REF TO data,
        lp_struct2 TYPE REF TO data,
        lp_table   TYPE REF TO data,       " Pointer to dynamic table
        lp_table2  TYPE REF TO data,       " Pointer to dynamic table
        ls_lvc_cat TYPE lvc_s_fcat,
        lt_lvc_cat TYPE lvc_t_fcat.        " Field catalog
    * First column
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'MATNR'.
      ls_lvc_cat-ref_table = 'MARA'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * 2nd column
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'MAKTX'.
      ls_lvc_cat-ref_table = 'MAKT'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * 3rd column
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'MATKL'.
      ls_lvc_cat-ref_table = 'MARA'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * Create 1st internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING it_fieldcatalog = lt_lvc_cat
        IMPORTING ep_table = lp_table.
      ASSIGN lp_table->* TO <lt_data>.
    * Read data into 1st internal table
      SELECT matnr maktx matkl
        INTO TABLE <lt_data>
        FROM v_matnr
          UP TO p_max ROWS
       WHERE matnr IN s_matnr.
    * Create 2nd internal table
    * Checkbox
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'CHECKBOX'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * Table color
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'TABCOLOR'.
      ls_lvc_cat-ref_table = 'CALENDAR_TYPE'.
      ls_lvc_cat-ref_field = 'COLTAB'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * Create 2nd internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING it_fieldcatalog = lt_lvc_cat
        IMPORTING ep_table = lp_table2.
      ASSIGN lp_table2->* TO <data>.
    * Create structure = structure of the 1st internal table
      CREATE DATA lp_struct LIKE LINE OF <lt_data>.
      ASSIGN lp_struct->* TO <header>.
    * Create structure = structure of the 2nd internal table
      CREATE DATA lp_struct2 LIKE LINE OF <data>.
      ASSIGN lp_struct2->* TO <header2>.
    * Move data from 1st internal table --> 2nd internal table
      LOOP AT <lt_data> ASSIGNING <header>.
        DESCRIBE TABLE lt_lvc_cat.
        CLEAR <header2>.
    *   Fill the internal to display <data>
        DO sy-tfill TIMES.
          READ TABLE lt_lvc_cat INTO ls_lvc_cat INDEX sy-index.
    *     For each field of lt_lvc_cat.
          ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header>
                        TO <field>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header2>
                        TO <field2>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          <field2> = <field>.
        ENDDO.
    *   Modify color
        ASSIGN COMPONENT 'TABCOLOR' OF STRUCTURE <header2>
                      TO <field2>.
        IF sy-subrc EQ 0.
          PERFORM f_modify_color USING 'MAKTX' <field2>.
          PERFORM f_modify_color USING 'MATKL' <field2>.
        ENDIF.
        APPEND <header2> TO <data> .
      ENDLOOP.
    ENDFORM.                    " f_read_data
    *      Form  F_DISPLAY_DATA
    FORM f_display_data.
    * Macro definition
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-down      = 'X'.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_layout   TYPE slis_layout_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv.  " Field catalog
    * Build Fieldcatalog - First column
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MATNR'.
      ls_fieldcat-ref_tabname = 'MARA'.
      ls_fieldcat-key  = 'X'.
      APPEND ls_fieldcat TO lt_fieldcat.
    * Build Fieldcatalog - 2nd column
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MAKTX'.
      ls_fieldcat-ref_tabname = 'MAKT'.
      APPEND ls_fieldcat TO lt_fieldcat.
    * Build Fieldcatalog - 3rd column
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MATKL'.
      ls_fieldcat-ref_tabname = 'MARA'.
      APPEND ls_fieldcat TO lt_fieldcat.
    * Layout
      ls_layout-zebra = 'X'.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-box_fieldname = 'CHECKBOX'.
      ls_layout-coltab_fieldname = 'TABCOLOR'.
      m_sort 'MATNR'.                      " Sort by creation date
    * Display data
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = <data>.
    ENDFORM.                               " F_DISPLAY_DATA
    *      Form  F_modify_color
    FORM f_modify_color USING u_fieldname TYPE lvc_fname
                              ut_tabcolor TYPE table.
      DATA:
        l_rnd_value TYPE datatype-integer2,
        ls_tabcolor TYPE lvc_s_scol.
    * Random value
      CALL FUNCTION 'RANDOM_I2'
           EXPORTING
                rnd_min   = 0
                rnd_max   = 3
           IMPORTING
                rnd_value = l_rnd_value.
      CLEAR ls_tabcolor.
      ls_tabcolor-fname = u_fieldname.
      CASE l_rnd_value.
        WHEN 0.
          ls_tabcolor-color-col = 1.       " Blue.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 1.
          ls_tabcolor-color-col = 3.       " Yellow.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 2.
          ls_tabcolor-color-col = 5.       " Green.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 3.
          ls_tabcolor-color-col = 6.       " Red.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
      ENDCASE.
      INSERT ls_tabcolor INTO TABLE ut_tabcolor.
    ENDFORM.                               " F_MODIFY_COLOR
    Reward all helpfull answers
    Regards
    Pavan

  • Disabling the display maximum rows per page

    My project include many reports with table view, displaying 100 rows.
    There is always arrows icon with the option to display maximum rows per page.
    If user click on that option the OBIEE crashed, since there are a lot of rows.
    I cannot decrese this number since all rows are required for other charts views.
    a. Is there a way to set this parameter only for the table view?
    b. Is there a way to disable this icon or not presenting it to the user?
    c. Is there global way to coonfigure the default displayed rows number (e.g. from 100 to 20)?

    unfortunately, you are limited to the SRW built-ins in Reports as far as setting object properties is concerned. I have checked this with the Metalink staff and I did get an admission out of them that this is true.
    You can set the property in the property palette, but I'm not sure that this helps you as I take it you have a condition you would like to implement. I wish I could help you further, but Reports is limited in some areas, and setting object properties programmatically is one of them.

  • To delete the row for the corresponding checked rows in alv

    hi,
    i have a alv report with check boxes,
    can any one say how to delete the row for the corresponding checked rows.

    hi
    give In REUSE_ALV_LIST_DISPLAY
    I_CALLBACK_USER_COMMAND  = P_USER_COMMAND
    FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                              RS_SELFIELD TYPE SLIS_SELFIELD.
    IF R_UCOMM = C_DELETE. where CONSTANTS : C_DELETE(6) TYPE C VALUE 'DELETE',
      READ TABLE IT_ITAB WITH KEY REC_SEL = C_X.
    LOOP AT IT_MARA WHERE REC_SEL = 'X'.
            MOVE-CORRESPONDING IT_ITAB TO IT_TEMP.
            APPEND IT_TEMP.
            CLEAR IT_TEMP.
          ENDLOOP.
    where it_temp IT_TEMP TYPE STANDARD TABLE OF itab WITH HEADER LINE,
    DELETE ITAB FROM TABLE IT_TEMP.
    HOPE THIS HELPS
    PRIYA

  • Disable the checkbox after some operation

    Hi all,
    i am doing a ALV. I have a check box in the first column. i am selecting a row and  doing some checking.
    my requirement is to disable that row (which is checked ) after the checking opearion.
    how do i do that ?
    Thanks
    Niramala

    Hi,
    If you are using FM for ALV, you can still try above method with some additional steps:
    - use FM GET_GLOBALS_FROM_SLVC_FULLSCR to switch between classic ALV (by means of REUSE_ALV_GRID_DISPLAY) to OO ALV.
    "first register some event which is always called for FM REUSE_ALV... i.e. TOP-OF-PAGE
      data:  lt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = lt_alv_events.
      READ TABLE lt_alv_events WITH KEY name = slis_ev_top_of_page
                           INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_top_of_page TO ls_event-form.
        APPEND ls_event TO ft_alv_events.
      ENDIF.
    "now show your ALV output with this registered event
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
         it_events  = it_alv_events
    "then when TOP-OF-PAGE event is raised you can switch from classic ALV to OO ALV.
    form top_of_page.  "this one is called once TOP-OF-PAGE is raised
      DATA: lo_grid TYPE REF TO cl_gui_alv_grid.
    " get reference for classic ALV
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = lo_grid.
    "here you put your coding as given above
    " now you can refresh the table display
      CALL METHOD lo_grid->refresh_table_display
        EXPORTING
          i_soft_refresh = 'X'.
    endform.
    That should work
    Regards
    Marcin

  • How can I disable the Album thumbnail row?

    When the visitor clicks a thumbnail in an image album, the individual image appears with a scrollable thumbnail row above it for directly jumping to any other image in the album. I find that noisy and distracting! Is there any way to disable or remove it? There are two icons between the "Back to Album" and "Download" links that run a script "widget2.toggleThumbnails()" that turns it off and on, so just setting the default for that to "off" would be enough. I've searched every combo of words for this subject I can think of and not found any clue. Puzzled, this seems really fundamental to the user experience.
    Thanks for any help.

    Thumbnail row is generated by javascript widget, so logically it can be turned off with javascript.
    It would take a very simple javascript to turn it off. Drop me an email: hac{dot}le{at}sbcglobal{dot}net

  • How to make the checkbox field as enabled/disabled?

    HI,
    i want to enable/disable the checkbox
    at run time??
    is it possible to do it??

    Hi user10185229 ,
    You can do this with SPEL.
    Thanks.....

  • How to Disable a Checkbox on a report condionally.

    I have a report and I created a checkbox on this report.
    I have a button which is associated to the checkbox.
    When I check a record an click the button I delete that record.
    This all works great.
    I want to disable the checkbox based on a condition.
    Lets say I cannot delete DEPT rows 20 at all. In this case I want to disable the checkbox and do not allow use to delete these records.
    Can anyone help me on this.
    I really appreciate your help on this.

    In your SQL query, you may be able to use a CASE WHEN statement to accomplish this.
    SELECT .. CASE WHEN dept_id = 20 THEN <dont display checkbox or show disabled> ELSE <show checkbox> END
    Ravi

  • Disable the Goods Receipt check box in PO creation

    Hi Gurus,
    In the Item screen of ME21N, Delivery Tab my client wants to disable the checkbox Goods receipt, as its coming now always checked by default, is there any settings in SPRO where I can disable this.
    Thanks
    Amresh

    Hi,
    The Goods receipt indicator in PO item  is based on configuration of Account Assignment Category
    SPRO->Materials Management->Purchasing->Account Assignment->Maintain Account Assignment Categories
    Regards,
    Vinod

  • How to Edit selected row in ALV

    Hi Experts,
                    I new to webdynpro ABAP. How to Edit the entire selected row in ALV. Please suggest?
    Thanks in advance.

    Hi,
    I guess you have created the node as dynamic and also set this to the ALV..
    1.  Have you created READ_ONLY attribute of type wdy_boolean inside the node to which the ALV is bound..If not create it first and set the default value for this readonly as abap_true...ie X.
    2.  Got the contents in the internal table.
    bind the table to the node..
    3.Instantiate the ALV.
    4. Now get teh column refrences of this ALV using the cl_salv_wd_config_table..and for columns
    use the cell editor type as cl_salv_wd_uie_input_field...
    loop through the column references and for all refrences create an object of type Input field and inside this class
    use the method set_read_only_field_name ( 'READ_ONLY' ).
    For the table settings if_salv_wd_table_settings of cl_salv_wd-config_table.. set the read only mode as abap_false..
    5 create the custom button in the ALV using the cl_salv_wd_fe_button..
    6 In this go for the events ON_FUCNTION and inside this method..do the coding
    7 .Initially the table will  be set to non editable..
    In the button handler....
    Get the refernece of this node to which the ALV is bound.....
    lr_node = wd_context->get_child_node( 'VBAK' ).  "dynamic node name
    lv_index  = lr_node->get_lead_selection_index ( ).
    loop at it_table into ls_table.
    if sy-tabix eq lv_index.
    ls_table-read_only = abap_false.  "editable
    else.
    ls_table-read_only = abap_true. "non editable
    endif.
    modify table
    endloop.
    lr_node->bind_table( lt_table ).
    If you have any doutbs just refer the previous thread posted on the same..
    You can follow the above steps to acheive thjs..
    Regards,
    Lekha.
    Edited by: Lekha on Dec 17, 2009 6:10 PM

  • How to disable the first row of an ALV Grid?

    Hi All,
          I am working on a module pool programme. I am displaying ALV grid. I have to give some default values in the first row and disable it. I have to disable the third column and fourth row value. How can i achieve this?
    Help will be appreciated.
    Thanks,
    Ibrahim.

    here is the code i have written....but its not working...
    TYPES : BEGIN OF tp_grid,
            fname(25)   TYPE c,
            reqd,
            seqno       TYPE n,
            tl_styl TYPE lvc_t_styl,
            edit,
            END OF tp_grid.
    DATA : wl_styl TYPE lvc_s_styl.
    DATA : wl_layout TYPE lvc_s_layo.
    DATA : lt_celltab TYPE lvc_t_styl.
      READ TABLE tl_grid INTO wl_grid INDEX 1.
      wl_styl-fieldname = 'TAG NUMBER'.
      wl_styl-style = cl_gui_alv_grid=>mc_style_disabled.
      INSERT wl_styl INTO TABLE lt_celltab.
      INSERT LINES OF lt_celltab INTO  wl_grid-tl_styl index 1.
      MODIFY tl_grid INDEX 1 FROM wl_grid.
      wl_layout-stylefname = 'TL_STYL'.
      CALL METHOD l_initgrid->set_table_for_first_display
        EXPORTING
          is_layout                     = wl_layout
        CHANGING
          it_outtab                     = tl_grid
          it_fieldcatalog               = tl_init_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    ENDFORM.                    " display_initgrid
    Help will be appreciated....
    Thanks,
    Ibrahim

  • How to enable /disable the row in ALV?

    Hi Experts,
    I have gone through some threads on this but I did not find useful to my requirement.
    My requirement is:
    Consider two columns : one is set delete column (a button) and another editable field.
    When the user presses on set delete button. The editable field should be disabled and it should be enabled whenever the user presses the button again.
    Kindly let me know the solution.
    Thanks.

    Hi,
    As i am also new to web dynpro abap. I found it a gud thing to learn about ALV grid.
    So, I tried doing it like that and found that its not at all difficult.
    Here is the procedure that i followed.
    1. Create a context node with two attribute from any table structure and one attribute of type wdy_boolean for controlling the
        enable property of input field.
    2. i used the supply function to fill the node. Here is the code for the same.
    data lt_dealer type wd_this->Elements_zdealer.             "My node name is zdealer
    DATA ls_dealer LIKE LINE OF lt_dealer.
    select * from zdealer into corresponding fields of table lt_dealer.
    loop at lt_dealer into ls_dealer.
      ls_dealer-enable = abap_true.                             "to enable all the fields initially
      modify lt_dealer from ls_dealer.
      endloop.
    node->bind_table( lt_dealer ).
    3. create view container UIelment in the view and embed table view of the ALV used comp.
    4.  add interface controller of SALV_WD_TABLE to the used controller in the view and also add comp controller of our
    local comp to the used controller list of interface contrl of Used comp. And then map the data node to the node we have filled in
    the supply function.
    5. go to the wddoinit method to configure the ALV grid. means adding button and input field and binding the enable property of
    input field. Here is the code for the same.
    data lo_cmp_usage type ref to if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
      if lo_cmp_usage->has_active_component( ) is initial.
        lo_cmp_usage->create_component( ).
      endif.
      DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
      lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv( ).
        DATA lo_value TYPE ref to cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
    lo_value->IF_SALV_WD_TABLE_SETTINGS~SET_CELL_ACTION_EVENT_ENABLED( abap_true ).
    lo_value->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( ABAP_FALSE ).
    data btn type ref to cl_salv_wd_uie_button.
    data inp type ref to cl_salv_wd_uie_input_field.
    data col1 type ref to cl_salv_wd_column.
    data col type ref to cl_salv_wd_column.
    data col2 type ref to cl_salv_wd_column.
    call method lo_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN
    exporting
      id = 'NAME'                         "col name is NAME (col with button)
      receiving
      value = col.
    call method lo_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN
    exporting
      id = 'LOCATION'                "col name is LOCATION (col with input field)
      receiving
      value = col1.
    call method lo_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN
    exporting
      id = 'ENABLE'                   "this col is used to control the enable property of input field and we will make it invisible.
      receiving
      value = col2.
    create object btn.
    CREATE OBJECT INP
    EXPORTING
      VALUE_FIELDNAME = 'LOCATION'.
    inp->set_enabled_fieldname( 'ENABLE' ).
    COL1->SET_CELL_EDITOR( INP ).
    btn->SET_TEXT_FIELDNAME( 'NAME' ).
    col->set_cell_editor( btn ).
    col2->set_visible( '01' ).                     " making the enable col invisible
    Now you need to create one eventhanlder for the action of cell action.
    for this create an eventhandler and then even col there select ON_CELL_ACTION for the inerface cntrl of ALV.
    now write the code in this eventhandler for enabling or disabling the input field after checking the current value and
    row number from which the button was clicked. code for the same.
    DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
      lo_INTERFACECONTROLLER =   wd_this->wd_cpifc_alv( ).
        DATA lo_value TYPE ref to cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
    data inp type ref to cl_salv_wd_uie_input_field.
    data col1 type ref to cl_salv_wd_column.
    data str type string.
    str = R_PARAM->COLUMN.
    data indx type i.
      indx = r_param->index.               " this will get the row number
      DATA lo_nd_zdealer TYPE REF TO if_wd_context_node.
      DATA lo_el_zdealer TYPE REF TO if_wd_context_element.
      DATA ls_zdealer TYPE wd_this->element_zdealer.
      DATA lv_value LIKE ls_zdealer-enable.
    * navigate from <CONTEXT> to <ZDEALER> via lead selection
      lo_nd_zdealer = wd_context->get_child_node( name = wd_this->wdctx_zdealer ).    
    lo_el_zdealer = lo_nd_zdealer->get_element( index = indx ).     " get the corresponding element.
    lo_el_zdealer->get_attribute(
        EXPORTING
          name =  `ENABLE`
      importing
          value = lv_value ).
    IF str EQ 'NAME'.
      if lv_value eq abap_true.
    lo_el_zdealer->set_attribute(
        EXPORTING
          name =  `ENABLE`
          value = abap_false ).
    else.
      lo_el_zdealer->set_attribute(
        EXPORTING
          name =  `ENABLE`
          value = abap_true ).
      endif.
    ENDIF.
    this will solve it.
    Thanks and Regards,
    Sarbjeet singh

  • ALV grid checkbox at row level

    Hi Experts,
                        I have  a requirement to make check box in ALV grid as non-editable for some rows, according to  certain conditions.
    How can I achieve this ?
    Thanks in advance
                       Sanu

    refer below demo program
    BCALV_EDIT_05
    in above demo program  find the folloing code...
    ls_celltab-fieldname = 'CHECKBOX'.
      ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
      loop at gt_outtab.
        l_index = sy-tabix.
        refresh lt_celltab.
    here as per the condition u make the checkbox disable cl_gui_alv_grid=>mc_style_enabled
        ls_celltab-fieldname = 'CHECKBOX'.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        insert ls_celltab into table lt_celltab.
        insert lines of lt_celltab into table gt_outtab-celltab.
        modify gt_outtab index l_index.
      endloop.
    Edited by: shan palani on Dec 16, 2008 11:48 AM

  • Grey out(disable) a row in ALV grid

    Hi,
    I want to know how to grey out(disable) row wise in ALV grid display.
    i..e.. Few rows in ALV grid display shoud be editable and few rows non editable based on certain condition.
    How do we do that....Please help.
    Thanks in advance.

    Hi,
    Since fieldcatalog is used to modify coloum and not the row, the fieldcatalog would not solve the problem.
    Thankyou.

  • Show the checkbox as selected by selecting the row.

    Hi friends,
    I have a table. It is possible to select multiple rows, after selecting rows, I get the selected
    rows in this table from the context. Now my question is, how can i cause that by selecting a row
    the checkbox on this row will be also selected (shown as checked)?
    So this is the coding in the eventhandlermethod on onselect property of the table:
    METHOD onactionmark_cb .
      DATA lo_nd_table_data TYPE REF TO if_wd_context_node.
      DATA lo_el_table_data TYPE REF TO if_wd_context_element.
      DATA ls_table_data TYPE wd_this->element_table_data.
      DATA lt_table_data TYPE wd_this->elements_table_data.
      DATA lt_set TYPE wdr_context_element_set.
    DATA lv_idx TYPE i.
    navigate from <CONTEXT> to <TABLE_DATA> via lead selection
      lo_nd_table_data = wd_context->get_child_node( name = wd_this->wdctx_table_data ).
    This would now contain the references of all the selected rows
      CALL METHOD lo_nd_table_data->get_selected_elements
        RECEIVING
          set = lt_set.
      LOOP AT lt_set INTO lo_el_table_data.
        " Use the references to get the exact row data
        CALL METHOD lo_el_table_data->get_static_attributes
          IMPORTING
            static_attributes = ls_table_data.
        APPEND ls_table_data TO lt_table_data.
        CLEAR ls_table_data.
      ENDLOOP.
    mark/shhow the checkboxes checkd in the selected rows
    ENDMETHOD.
    Thank you for any help
    Haleh
    Edited by: Haleh Mir Ashrafi on Nov 9, 2008 6:29 PM

    Hi Haleh,
    I tried replicating your requirement and have written below the exact working code for the same. I will try to explain you my component so that you can get to understand its functionality. I have 2 tables & 1 input field in my view. The user enters a customer number in the input field and presses on a button. This leads to the corresponding sales orders filled into the 1st table ui element. The user then selects multiple rows from this table and presses on a toolbar button to copy these selected rows to the 2nd table. Within the same event I also set the checkbox for the rows selected by the user in the 1st tables row to selected. Hope that this would meet your requirement. On pressing the button the system would check if the checkbox is enabled & then mark the selected rows checkboxes as selected and would also copy the rows to the 2nd table. If the checkbox is disabled then the system would neither set it as checked nor copy it to the 2nd table. The rest of the checkboxes for the rows which weren't selected by the user remain as unchecked.
    METHOD onactioncopy_selected_rows .
      DATA:  wd_node TYPE REF TO if_wd_context_node,
             ls_node1 TYPE ig_componentcontroller=>element_node1,
             lt_node1 TYPE ig_componentcontroller=>elements_node1,
             wa_temp  TYPE REF TO if_wd_context_element,
             lt_temp  TYPE wdr_context_element_set.
      wd_node = wd_context->get_child_node( name = 'NODE1' ).
      " Get all the context element information for the rows selected by the user
      CALL METHOD wd_node->get_selected_elements
        RECEIVING
          set = lt_temp.
      " Just get the reference of the 2nd table to which you want to copy selected rows
      wd_node = wd_context->get_child_node( name = 'NODE2' ).
      LOOP AT lt_temp INTO wa_temp.
        CALL METHOD wa_temp->get_static_attributes
          IMPORTING
            static_attributes = ls_node1.
        " Check if the checkbox is disabled/enabled. The "enabled" property of the checkbox
        " is bound to the boolean context attribute by name ENABLED
        IF ls_node1-enabled EQ abap_true.
          wa_temp->set_attribute( EXPORTING name  = 'CHECKBOX'
                                            value = abap_true ).
          APPEND ls_node1 TO lt_node1.
          CLEAR ls_node1.
        ENDIF.
      ENDLOOP.
      " Bind the rows selected by the user to the 2nd table ui element
      wd_node->bind_table( new_items = lt_node1 ).
    ENDMETHOD.
    I have checked your code where you say like:
    IF elem_test->is_selected( ) = abap_true AND stru_test-enabled = abap_false.
    You had earlier fetched the entire elements list using the get_elements method of if_wd_context_node & then checking each 1 of them individually to determine whether it was selected or not using the method id_selected. You can directly get only the elements which were selected by the user by using the method get_selected_elements instead. So now you will only have to check whether the checkbox field in that particular row is disabled/enabled. You now don't have to combine 2 conditions using AND & check them within the loop.
    Regards,
    Uday

Maybe you are looking for