cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the read only property for dynamic ALV column

Former Member
0 Kudos

Hi All,

I have built one dynamiv ALV and I have one name column inside that ALV for which I have to set read only property based on two column fields that exist in the same ALV,say IS_SP and IS_CORP of type boolean.

If any one of the flag is 'X',i have to make that name column as display only and

If both flag are not set,it should be displayed as ediatable column.

I have written one method as INIT_ALV which gets called when ALV is loaded.

Code is as follows:

lr_column_settings ?= wd_this->alv_all_roles.

lt_columns = lr_column_settings->get_columns( ).

LOOP AT lt_columns INTO ls_column.

CASE ls_column-id.

WHEN <NAMECOLUMN>. "name column which should be editable/display

    • Create Input Field

CREATE OBJECT lr_uie_input_field_ro

EXPORTING

value_fieldname = ls_column-id.

ls_column-r_column->set_cell_editor( lr_uie_input_field_ro ).

After this,I have to set the read only property based on IS_SP and IS_CORP values,

CALL METHOD lr_uie_input_field_ro->set_read_only_fieldname

EXPORTING

*value = 'IS_SP' or 'IS_CORP'

ENDLOOP.

I dont want to use cell variants also.

Help me to achieve this.

Thanks and Regards,

Divya

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Divya - I have done it in the past following these documents. Please read it and try it it will work.

Please read it in the following order since both are a continuation documents for the same purpose (it also contains how to change colors of row dynamically but I didnt do that part I just did the read_only part as your requirement)

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71...

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d...

thanks!

Jason PV

Former Member
0 Kudos

Hi Jason,

The issue is resolved.

I used set_read_only_fieldname method and passed IS_SP value and then

I used set_enabled_filedname method and passed IS_CORP value.

But while populating the ALV data,i negated the IS_CORP values as

loop

If <Str>-is_corp = abap_true.

<Str>-is_corp = abap_false.

else.

<Str>-is_corp = abap_true.

endif.

endloop.

so that the enabled property is set reversely and it wrks fine.

Anyways the links are helpful.

Regards,

Divya S