cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a row of ALV table readonly

Former Member
0 Kudos

hi,

I am using alv in webdynpro. There is one column with inputfield as cell editor. Based on some conditions i have to make that column read only for some records and editable for others.

How can i bind the readonly property of context attribute with alv column?

thanks,

Varuna

Accepted Solutions (0)

Answers (2)

Answers (2)

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

To make an input field read only:

CREATE OBJECT lo_inputfield

EXPORTING

value_fieldname = 'APPR_STATUS'.

lo_column = lo_column_setting->get_column( 'APPR_STATUS' ).

lo_column->set_cell_editor( lo_inputfield ).

LO_INPUTFIELD->SET_READ_ONLY( ABAP_TRUE)

based on your conditions you can make it ABAP_TRUE or ABAP_FALSE.

Priya

.

Former Member
0 Kudos

check this Wiki https://wiki.sdn.sap.com/wiki/display/WDABAP/How%20to%20edit%20conditionally%20row%20of%20a%20ALV%20...

Conditionally Assigning Colors and Input Enable to ALV Columns in Web Dynpro for ABAP

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f0625002-596c-2b10-46af-91cb31b71393

The steps would be :

1.Add attributes READONLY of type ABAP_BOOL to the node binded to table.

2. Based on logic assign Readonly values.

loop at itab into wa.

if wa-C1 > 0.

wa-readonly = abap_true.

else.

wa-readonly = abap_false.

endif.

modify itab from wa.

endloop.

3. Now add this read only attribute to the column which you wanted.

l_column = l_value->if_salv_wd_column_settings~get_column( 'C2' ).

CREATE OBJECT lo_input

EXPORTING

value_fieldname = 'C2'.

l_column->set_cell_editor( lo_input ).

lo_input ->set_read_only( value = 'READONLY')