cancel
Showing results for 
Search instead for 
Did you mean: 

Radiobutton

Former Member
0 Kudos

hi all,

i have an issue.I had designed a screen using WD4A.In the screen i have two radio button.I had to code for these radio buttons.When the user clicks on one radio button and click on save button,the entries to be stored in one table.If the user clicks on another button,the entries from the table get deleted.

please help me......

useful answers get rewarded.

with regards

Sandeep Sharma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sandeep,

Read the context value attached to the radio button.

which so ever value is ABAP_TRUE, populate the table accordingly.

Hope this helps.

Regards,

Kinshuk

Former Member
0 Kudos

On the event handler of the save button, inside the method write the code like this...

DATA lo_nd_flag1 TYPE REF TO if_wd_context_node.
    DATA lo_el_flag1 TYPE REF TO if_wd_context_element.
    DATA ls_flag1 TYPE wd_this->element_flag1.
    DATA lv_flag LIKE ls_flag1-flag.
*   navigate from <CONTEXT> to <FLAG1> via lead selection
    lo_nd_flag1 = wd_context->get_child_node( name = wd_this->wdctx_flag1 ).

*   get element via lead selection
    lo_el_flag1 = lo_nd_flag1->get_element(  ).

*   get single attribute
    lo_el_flag1->get_attribute(
      EXPORTING
        name =  `FLAG`
      IMPORTING
        value = lv_flag ).

Here flag1 is the node and flag is the attribute, so in ur case go to the code wizard (ctrl + f7) and click on the radio button read context...there provide the name of ur radio button,,,you will get the value is say lv_flag variable.

So just read like

if lv_flag = 'X'.
* Write ur code
else.
* Write ur code
endif.

Hope it works..

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sandeep,

you pls refere to View: RADIOBUTTON in web dynpro component WDR_TEST_EVENTS .

This will helps you to understand the logic behind this.

in Group1 of this screen you can see actions triggered for radio button selection.

-Kiran Singh