on 07-30-2007 11:11 AM
Hi gurus
Is it possible to make an ALV cell input ready (column default is read only) depending on the content of a different cell?
Kind regards
Wouter Heuvelmans
Pyramid Applied Solutions
Hi Wouter,
Yes, this can be done. To do this, in your context, apart from your display fields, add another attribute READ_ONLY of type char01. And lets assume you want the field by name field_1 to be editable or not based the value in field read_only.
Your code will be like this to initialize the ALV:
DATA:
l_alv_model TYPE REF TO cl_salv_wd_config_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_col TYPE SALV_WD_T_COLUMN_REF,
ls_col TYPE SALV_WD_S_COLUMN_REF,
lr_input_field type ref to cl_salv_wd_uie_input_field.
l_alv_model = l_ref_interfacecontroller->get_model( ).
l_alv_model->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( abap_false ).
lr_column_settings ?= l_alv_model.
lt_col = lr_column_settings->get_columns( ).
LOOP AT lt_col INTO ls_col where ID = 'FIELD_1'.
create object lr_input_field exporting value_fieldname = ls_col-id.
<b>lr_input_field->set_read_only_fieldname( 'READ_ONLY' ).</b>
ls_col-r_column->set_cell_editor( lr_input_field ).
ENDLOOP.
By using the method set_read_only_fieldname, we define the field based on whose value the column should be made read only on not.
In the wddoinit method, or any other method where you populate the internal table for binding to the ALV table, set the field read_only for each row. If the field that you mention is not of type char01, then depending on your criteria field value, set the read_only field. So if you have 5 rows in your table and the field read_only is X for all but the 3rd row, only the 3rd row will be input enabled.
Hope this is clear.
Regards
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no way in WD ABAP . If you want you make like if you double click on that cell you can make it to Input. In that case you need to make the total column as input mode. you can't make the perticulat cell as editable means accepts input.
I hope you are clear now
Warm Regards,
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.