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
parent_element->get_static_attributes(
IMPORTING
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.
node->bind_structure(
new_item = ls_zread_only
set_initial_elements = abap_true ).
ELSE.
CLEAR ls_zread_only-readonly.
ls_zread_only-readonly = abap_false.
node->bind_structure(
new_item = ls_zread_only
set_initial_elements = abap_false ).
ENDIF.
Thanks for your time!
Regards,
M M Jaffer