Skip to Content

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

Disabling button if the check box is uncheked

Hai all,

I want to enable the button once checked the check box. Am using this code,

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->Element_context.

DATA lv_check_button TYPE wd_this->Element_context-check_button.

lv_check_button = 'ABAP_TRUE'.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_context IS INITIAL.

ENDIF.

  • set single attribute

lo_el_context->set_attribute(

EXPORTING

name = `CHECK_BUTTON`

value = 'lv_check_button' ).

Am getting it.

Once I uncheck the check box means the button has to be disabled. What can I do to resolve this. Pls give some suggestions.

Thanks in Advance,

Nalla.B

Former Member
Former Member replied

Hi Nalla,

This is the code i am using it is working for me..

I created two attributes enable and check, and i bind check with checkbox checked property and enable with button enable property.

Write this code on_toggle action of check box.

DATA lo_el_context TYPE REF TO if_wd_context_element.

DATA ls_context TYPE wd_this->Element_context.

DATA lv_check TYPE wd_this->Element_context-check.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • get single attribute

lo_el_context->get_attribute(

EXPORTING

name = `CHECK`

IMPORTING

value = lv_check ).

if lv_check = 'X'.

DATA lv_enable TYPE wd_this->Element_context-enable.

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

  • set single attribute

lo_el_context->set_attribute(

name = `ENABLE`

value = ABAP_TRUE ).

else.

  • set single attribute

lo_el_context->set_attribute(

name = `ENABLE`

value = ABAP_FALSE ).

endif.

Cheers,

Kris.

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