cancel
Showing results for 
Search instead for 
Did you mean: 

SET_ATTRIBUTE_PROPERTY doesnt work

Former Member
0 Kudos

Hi All,

I have a declared a node ABC cardinality 1:1 under the context of my view and under this node ABC i have an Attribute MARK type boolian.

in the layout, I have a UI element check box for which I have binded the attribute MARK.

Now I want to set the read_only property dynamically to this check box.

LO_ND_ABC = WD_CONTEXT->GET_CHILD_NODE( NAME =  WD_THIS->WDCTX_ABC ).

LO_EL_ABC = LO_ND_TRAVEL_DATA->GET_ELEMENT( ).

CALL METHOD LO_EL_ABC->SET_ATTRIBUTE_PROPERTY
     EXPORTING
       ATTRIBUTE_NAME = 'MARK'
       PROPERTY       = 3
       VALUE          =  'X'.


But the check box was not set with read_only property.

I have searched many threads and after which i am raising this problem here.


I have also tried SET_ATTRIBUTE_PROPS_FOR_ELEM and SET_ATTRIBUTE_PROPS_FOR_NODE aswel.. but nothing worked out..

Please help.


I don't want to create an attribute and bind it to read_only property of the check box in the layout.

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Try the below code in wddomodifyview( ) method of your view

data lo_check_box type ref to cl_wd_checkbox.

lo_check_box ?= view->get_element( 'CHECK_BOX_NAME' ).

if lo_check_box is bound.

     lo_check_box->set_read_only( value = abap_true ).

endif.

Based on your requirement modify the above code,

Regards,

Rama

Former Member
0 Kudos

Its working.....Really loved your answer...

I actually afraid of thinking people suggest me to go for searching some other links or will ask me to create attribute and bind it to properties.

ramakrishnappa
Active Contributor
0 Kudos

Its good to hear ...:)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi All

if you are facing the same situation and

If you want to make  SET_ATTRIBUTE_PROPERTY  to work follow the below additional steps

along with the points i mentioned in my initial question

1. goto checkbox in the layout

2. bind MARK againest to read_only property,

    when you are binding a popup opens which shows all the context nodes and attributes

    in the same popup you have a radio button

  

"Bind to the Property of the selected Attribute"   --  set it to read_only from the drop down


After this step SET_ATTRIBUTE_PROPERTY is working fine.