Skip to Content
avatar image
Former Member

How to disable other radiobuttons by selecting one radiobutton

Hi All,

according to my requirement there will be three radiobuttons named as COPY MASS UPLOAD AUTOMATED RATE PROCESSING

if suppose user selects copyradiobutton remaining two radiobuttons should be disabled.

but according to my output if i am selecting copybutton remaining two are not been disabling. kindly correct where i have went wrong and to achieve my functionality kindly send me the steps.

to display radio buttons in output i have followed these steps my node name is ZRADIO and my attribute name is KEY. and i have used RADIOBUTTONGROUPBYKEY UI ELEMENT and for the selectedkey property ui elementi have binded this key attribute. and in wddoinint method i have written the following code.

data nodeinf type ref to if_wd_context_node_info.

data node type ref to if_wd_context_node.

node = wd_context->get_child_node( 'ZRADIO' ). "ZRADIO is the node name

nodeinf = node->get_node_info( ).

data lt_vs type table of WDR_CONTEXT_ATTR_VALUE.

data ls_vs type WDR_CONTEXT_ATTR_VALUE.

ls_vs-text = 'Copy'.

ls_vs-value = '1'.

append ls_vs to lt_vs.

ls_vs-text = 'Mass Upload'.

ls_vs-value = '2'.

append ls_vs to lt_vs.

ls_vs-text = 'Automated Rate Processing'.

ls_vs-value = '3'.

append ls_vs to lt_vs.

nodeinf->set_attribute_value_Set(

name = 'KEY' "KEY is the attribute name

value_set = lt_vs

).

Thanks & Regards,

Naveen

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 08, 2011 at 02:56 PM

    For controlling these properties like enable and read only dynamically usually the procedure is to create an attribute of type

    Wdy_boolean.

    so go to your context tab and there create one attribute

    name = flag

    type = wdy_boolean.

    save it.

    now go to your layout tab there click on the property enable and bind it to this attribute by clicking on the button

    just beside the property.

    save it. and open the eventhandler of the radiobutton group and there write the code.

    wd_context->set_attribute(

    name = 'FLAG'

    value = abap_false

    ).

    save it and activate.

    now on selecting the radio button the group will be disabled.

    thanks

    sarbjeet singh

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 09, 2011 at 03:14 AM

    HELLO NAVEEN,

    you want to enable and disable the other two radio button on selection of one radio button...rite?

    to do this you will have to have an attibute of type wdy_boolean.......this attribute can recieve value abap_true and abap_false.....now this will enable or disable the radio buttons accordingly you can always set the value of this attribute logicaaly and get results as you want.

    now after adding this in the context node...you will bind this attribute to the enable property of the radio button you created in the layout.

    and in the event handler you can code like this

    if (condtion)
    "this part will make it disable
    wd_context->set_attribute( 
    name = ' '            "give the name of the attribute you just made
    value = abap_false
    ).
    
    else
    "this part will make it enable
    wd_context->set_attribute( 
    name = ' '            "give the name of the attribute you just made
    value = abap_true
    ).
    
    endif.

    hope now you will be clear...alsoo remember not only in case of radio button but in case of input fields etc also you will be following the same method. i.e of binding the enable property

    hope this may be helpfull to you.

    thanks and regards,

    sahai.s

    Add comment
    10|10000 characters needed characters exceeded

    • Method ONACTIONENABLE_DISABLE.

      DATA lo_nd_radio_node2 TYPE REF TO if_wd_context_node.
        DATA lo_el_radio_node2 TYPE REF TO if_wd_context_element.  DATA lw_index            TYPE I.
        DATA lo_el_radio_node2_1 TYPE ref to if_wd_context_element. 
        * navigate from <CONTEXT> to <RADIO_NODE2> via lead selection
        lo_nd_radio_node2 = wd_context->get_child_node( name = wd_this->wdctx_radio_node2 ).* call method get lead selection index to get index 
        CALL METHOD lo_nd_radio_node2->get_lead_selection_index
          receiving
            index  = lw_index.        lo_el_radio_node2_1 = wd_context->get_element(  ).    If lw_index = 1.  * call method set attribute property and pass value as 'X' to ENABLE 
        call method lo_el_radio_node2_1->set_attribute_property
          exporting
            attribute_name = 'FIRST_NAME_2'
            property       = 4
            value          = 'X'.
      * call method set attribute property and pass value as 'X' to ENABLE 
        call method lo_el_radio_node2_1->set_attribute_property
          exporting
            attribute_name = 'LAST_NAME_2'
            property       = 4
            value          = 'X'.        ELSE. 
      * call method set attribute property and pass value as SPACE to DISABLE
        call method lo_el_radio_node2_1->set_attribute_property
          exporting
            attribute_name = 'FIRST_NAME_2'
            property       = 4
            value          = space.* call method set attribute property and pass value as SPACE to DISABLE
        call method lo_el_radio_node2_1->set_attribute_property
          exporting
            attribute_name = 'LAST_NAME_2'
            property       = 4
            value          = space.  
         Endif.

      Endmethod.