Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

To make table cell as read-only based on some condition

Hello ABAPers,

I have a requirement to make the cell in the table of a Web Dynpro component read-only. There are 4 fields in the Table of a view which is mapped to the Context attribute, i.e. function, Number, Description etc. When the value of the Field 'Function' is

'0000016', I have to make the Number field as READ-ONLY(non-editable).

As suggested in SDN forums, I have created the sub-node to the main node in Context and added an attribute 'READ_ONLY'. I have made the cardinality as 1:1. I have also created the Supply Function Method(ZREADONLY) for sub-node that I have created and also set the context binding to the Read only property of the field 'Number' in the View Layout.

PFB the coding I have done in supply function method for setting the read-only attribute for the number field, but it is not working. Could anyone let me know what is the change I have to make this work?

DATA ls_parent_attributes TYPE wd_this->element_partner_h.

DATA l_partner LIKE ls_parent_attributes-partner _fct

Constants c_parent LIKE ls_parent_attributes-partner_fct VALUE '000016'.

DATA ls_zread_only TYPE wd_this->element_zreadonly



static_attributes = ls_parent_attributes).

CLEAR l_partner.

l_partner = ls_parent_attributes-partner_fct.

IF l_partner = c_partner.

ls_zread_only-readonly = abap_true.


new_item = ls_zread_only

set_initial_elements = abap_true ).


CLEAR ls_zread_only-readonly.

ls_zread_only-readonly = abap_false.


new_item = ls_zread_only

set_initial_elements = abap_false ).


Thanks for your time!


M M Jaffer

Former Member

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question