on 05-23-2008 1:14 AM
Hi,
for that particular coulm in table bind the property to an attribute say
x of type wdy_boolean.
then based on the condition use
data: lo_element TYPE REF TO if_wd_context_element.
lo_element = wd_context->get_element( ).
lo_element->set_attribute(
EXPORTING name = `x'
value = 'abap_true' ).
or
lo_element = wd_context->get_element( ).
lo_element->set_attribute(
EXPORTING name = `x'
value = 'abap_false' ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I would like only the specific cell in the ALV as enabled or disabled based on condition.
Please note : This is for ALV and not for normal table.
Thanks,
Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kumar,
Have a look at [this thread|; in which I have given the complete code to solve your problem. There is one post which explains how to set the cell editor, and one more post explains setting the cell as editable or read only.
You need to bind the read_only property of your node attribute (i.e, whichever column you want this behavior on), to another attribute (say FLD_READ_ONLY) in the same context node. And based on the value in attribute FLD_READ_ONLY, the cell property would be changed. Define this attribute of type char01. So based on your business logic, if you want the cell to be read only, set X in the attribute, and if you want it to be editable, set space.
I hope that would be clear enough. Please revert for any clarifications. Depending on your requirement, if you want the read_only property to change on lead selection, you can get the lead selection index and set the attribute FLD_READ_ONLY = X / space only for that element. This would make only one cell editable at a time.
You could also refer to this recent [thread|; for the same issue, where you would have some additional pointers.
Regards,
Nithya
Hi
By default all the columns in the alv table will be in display mode. if u want to make it editable u have to create an input field as cell editor for that particular column.
DATA lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
DATA lr_column TYPE REF TO cl_salv_wd_column.
lo_config_model_value->if_salv_wd_table_settings~set_read_only( abap_false).
lr_column = lo_config_model_value->if_salv_wd_column_settings~get_column( 'HEADER' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'HEADER'.
lr_column->set_cell_editor( lr_input_field ).
regards
chythanya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In your context have an additional attribte read_only. When you want to allow the column to be edited, set this attribute to space and bind the alv back.
the do the following ;
loop at lt_columns into ls_column.
case ls_column-id.
when 'COLUMN'.
create object lr_input_field
exporting
value_fieldname = ls_column-id.
lr_input_field->set_read_only_fieldname( 'READ_ONLY' ).
ls_column-r_column->set_cell_editor( lr_input_field ).
endcase.
endloop.
Shruthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
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.