cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the checkbox as readonly dynamically in abap webdynpro

former_member505773
Active Participant
0 Kudos

Hi All,

Can anyone please share how can we set the property of checkbox element in abap webdynpro?

i've tried using 'set_attribute_property' but seems like its not working?

Is that we need to create another attribute in the same Node to control on this checkbox?

Thanks in advance for all the help.

Regards,

Sham.

Accepted Solutions (1)

Accepted Solutions (1)

former_member505773
Active Participant
0 Kudos

Hi All,

i'm able to sort this out. Anyhow, we need to add one new attribute (i named is as READ_ONLY) in the Node with char01. Then, we can bind this new attribute to the checkbox element's read only.

By doing the set attribute to the "READ_ONLY" attribute, we are able to set the checkbox as read only.

  lo_el_xxxxx_node->set_attribute(

     name `READ_ONLY`

     value = abap_true ).

Former Member
0 Kudos

Its nice you have already achieved, however, I thought you want to do it without having another context attribute defined.

Thanks

Mohit

Answers (2)

Answers (2)

Former Member

Hi Sham,

Please use below code to set the check box as read only dynamically.

DATA : lo_checkbox  TYPE REF TO cl_wd_checkbox.

        lo_checkbox ?= view->get_element( 'CHECK'  ). " CHECK is you are UI element name

        lo_checkbox->set_read_only( abap_true ).


Thanks,

Prashanth

Former Member

Hi, you need to get reference of the UI element (checkbox) and then use method set_display_only as below->


DATA: lr_view      TYPE REF TO if_wd_view,

         lr_checkbox TYPE REF TO cl_wd_checkbox.

   lr_view ?= wd_this->wd_get_api( ).

   lr_checkbox ?= lr_view->get_element( 'CHECKBOX' ). "Mention name of the checkbox UI element

   lr_checkbox->set_display_only( value = abap_true ).

This will definitely work.

former_member505773
Active Participant
0 Kudos

Hi Kumar,

i try to implement the code. Somehow, its show me the method "set_display_only" is either private or protected.

Thanks.

Sham.