cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox in ALV.

Former Member
0 Kudos

Hi,

I've created an ALV with a column with checkboxes.

The problem is:

It's possible to make editable only some checkboxes cells of the column?

I've used the SALV_WD_TABLE component.

The code where i created the column with checkboxes is (in the WDDOINIT method of the VIEW):

...

  • instancing check box

data: lr_checkbox type ref to cl_salv_wd_uie_checkbox.

create object lr_checkbox

exporting

checked_fieldname = 'CHECK'.

lr_checkbox->set_read_only( value = abap_false ).

lr_column = l_value->if_salv_wd_column_settings~get_column( 'CHECK' ).

lr_column->set_cell_editor( lr_checkbox ).

...

Thanks for answers.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Avalor,

Yes its possible to make only some of the checkbox cells editable.

Follow the steps.

1. Create a additional field of type boolean in the source context node. Set default value as abap_true.

2. In instantiating the check box, set the read only field to the created boolean field name.

  • instancing check box

data: lr_checkbox type ref to cl_salv_wd_uie_checkbox.

create object lr_checkbox

exporting

checked_fieldname = 'CHECK'.

lr_checkbox->SET_READ_ONLY_FIELDNAME('FIELDNAME1').

lr_column = l_value->if_salv_wd_column_settings~get_column( 'CHECK' ).

lr_column->set_cell_editor( lr_checkbox ).

3. Delete the column of the boolean field, so that it ll not be visible.

DATA: l_ref_interfacecontroller TYPE REF TO IWCI_SALV_WD_TABLE .

l_ref_interfacecontroller = wd_This->wd_CpIfc_Alv( ).

data: l_value type ref to Cl_Salv_Wd_Config_Table.

l_value = l_ref_interfacecontroller->Get_Model().

  • delete column

l_value->if_salv_wd_column_settings~delete_column( 'FIELDNAME1' ).

4. Change the context boolean element of the context node to disable the checkbox of a particular row.

Hope it helps

Regards,

Rakesh.

Answers (1)

Answers (1)

Former Member
0 Kudos

This is certainly close to the solution.

My system is down for backup so I cant check code.

Essentially when you which to change the properties of a cell not an entire column,

then you do via a helper field in the table, which is set in each row for the table for the column

in question.

ie TABLE ROWS contain

field1, field2, etc, CHECK_BOX_FIELD, Checkbox_readonly_state

From memory it is the cell editor used in the column that is used to point the property at the extra field not the column object itself. I didnt check which object, you should check that.

However, I hope in principal you have the approach.

regards

Phil.