Skip to Content

RE:Web dynpro in ABAP -Diabling of button thru checkbox

Hi,

I have a requirement ie i have a button in a view .Also i have a check box in that view.Now my requirement is that if i check the checkbox then the button in the same view should be disabled.How to do this...................Screen shots will be helpful....

Thanks in ADVANCE,

ALEX.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 08, 2009 at 05:16 AM

    hi,

    Proceed as below :

    1. Create an Contex Attribute of type wdy_boolean.

    2. Bind this to enable property of Button.

    3. On the click of Checkbox, implement the Action for checkbox.

    4. Set the attribute's property to X to Enable the Button and ' ' to disable the button.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 08, 2009 at 05:16 AM

    Create a conetxt attribute of type wdy_boolean (ENABLED) and bind this to the enabled proeprty of teh button. crete a checkbox and button in the view, in the check box have a event for onToggle....

    Set the default value for checkbox as space in the contetx attribute and also X for the wdy_boolean type.(ENABLED).

    In the on toggle event handler -

    set the attribute to space to enable thebutton

    wd_context->set_attribute

    exporting

    value = 'X'

    name = 'ENABLED'

    Edited by: Lekha on Dec 8, 2009 10:47 AM

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 08, 2009 at 05:21 AM

    Hi Alex,

    Create an attribute of boolean type and bind it with the enabled property of the button. Now on the ONTOGGLE event of the radio button set the value of that attribute as abab_false using code wizard (Ctrl + F7).

    Refer: http://help.sap.com/saphelp_nwce10/helpdata/en/3c/3ebcdb7adff540956627904821280d/content.htm

    I hope it helps.

    Regards

    Arjun

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 08, 2009 at 05:36 AM

    hi ,

    1 create 2 context attribute ca_attr1 and ca_attr2 of type WDY_BOOLEAN , bind with ur ENABLE property of Button UI

    and enable property of checkbox

    2 create a action for the OnToggle Event of ur checkbox

    3 in the OnactionMethod , check whether the CjeckBox is ticked using Get_attribute method

    4 If check box is checked ( ir ca_attr is "ABAP_TRUE" or 'X'), disable ur button by setting ca_attr2 to "ABAP_FALSE"

    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
        DATA ls_cn_node TYPE wd_this->element_cn_node .
        DATA lv_attr2  LIKE ls_city-ca_attr2.
    *   navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
        lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr2).
     
    *   get element via lead selection
        lo_el_cn_node = lo_nd_cn_node->get_element(  ).
     
    *   get single attribute
        lo_el_cn_node->get_attribute(
          EXPORTING
            name =  `CA_ATTR2`
          IMPORTING
            value = lv_attr ).
    

    // if lv_attr is 'X ' ( checked) , set ca_attr1 to ' ' 
    IF lv_attr EQ ' X'.
    DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
        DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
        DATA ls_cn_node TYPE wd_this->element_cn_node .
    
    *   navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
        lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr1).
     
    *   get element via lead selection
        lo_el_cn_node = lo_nd_cn_node->get_element(  ).
     
    *   set single attribute
        lo_el_cn_node->set_attribute(
          EXPORTING
            name =  `CA_ATTR1`
         value = ' '  ).
    

    regards,

    amit

    Add comment
    10|10000 characters needed characters exceeded