Skip to Content
0
Feb 15, 2011 at 08:30 PM

Checkbox in SALV needs to be disabled

942 Views

All,

I am using a column in SALV report as checkbox. currently all rows of that column (checkbox) is enabled.. But my requirement to is on the basis of another column value in the output table i need to disable check box in some rows.

my code for creating check box is

* Get the Editable Checkbox 
  DATA: lo_cols_tab TYPE REF TO cl_salv_columns_table,
        lo_col_tab  TYPE REF TO cl_salv_column_table.
 
*   get Columns object
  lo_cols_tab = o_alv2->get_columns( ).
 
*   Get VBELN column
  TRY.
      lo_col_tab ?= lo_cols_tab->get_column( 'CHK' ).
    CATCH cx_salv_not_found.
  ENDTRY.
 
*   Set the HotSpot for VBELN Column
  TRY.
        CALL METHOD LO_COL_TAB->SET_CELL_TYPE
          EXPORTING
            VALUE = IF_SALV_C_CELL_TYPE=>CHECKBOX_HOTSPOT.
 
  ENDTRY.

Courtesy Naimesh Patel