cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Row Editable for specific column

Former Member
0 Kudos

Hi,

I am creating a transaction using ALV - Webdynpro. I would like to enable or disable the row ,(specific column in that row ).

Problem is very similar to the thread posted in the below link.

Please let me know how to achive the scenario.

Thanks,

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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' ).

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks a lot Nithya. It really helped in fixing our problem

Former Member
0 Kudos

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

Former Member
0 Kudos

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