Reg ALV - Urgent
The following is my requirement.
I have to make the entire row of my ALV Table Ineditable
based on the content of a field in that row.
Say, In my ALV table, i have a column field 'STATUS'
If in a row, the status cell has value 'Released' then that entire row should be ineditable else editable.
Need your Inputs ASAP.
Srinivasa Raghavachar replied
For this, you have to make the column editable and then use the property called set_visible_fieldname.
I assume currently you have made your ALV editable.
Next to make an ALV selectively editable or non-editable, add a string attribute say 'EDITYESNO'. Based on the value of your release status set the the value of 'EDITYESNO' to '02'(Editable) or '00' (Non-editable).Say the column name you want to make editable or non-editable is 'NAME', then use the following code.
set cell editor for input fields
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
lr_column type ref to CL_SALV_WD_COLUMN.
lr_column_settings ?= l_value.
lr_column = lr_column_settings->get_column( 'NAME' ).
CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'NAME'.
lr_input_field->set_visible_fieldname( 'EDITYESNO' ).
lr_column->set_cell_editor( lr_input_field ).