Skip to Content
avatar image
Former Member

Table with Radio buttons, not reflecting when I change the selection

Hi,

I am working on a requirement in ABAP dynpro, where I need to display a table with 3 columns, in which first column is a text and the other two columns are radio buttons.

Initially I am populating the internal table, only one radio button is checked, which is fine. But during runtime when I try to change the radio button selection, it is not reflecting in the table context. So when I go to next page and come back, in my table both radio buttons of a row is checked. Where the result should look like one radio button in a row only.

I tried with events on radio button, but it still did not work.

Could anyone give me an idea about how to work with it?

Thanks in Advance,

Sreekanth

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 09, 2009 at 12:15 PM

    Hi Shreekanth,

    Try this. Create an event method for the radio button. Now when user selects radio button one you clear the attribute of radio button 2 in the event and bind the element again.

    " Event for radiobutton1.
    Data: l_elem type ref to if_wd_context_element.
    
    l_elem = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
    l_elem->get_static_attributes( importing static_attributes = ls_stru ).
    
    clear ls_stru-radiobutton2. " radiobutton2 is your attribute bound to 2nd radiobutton column
    l_elem->set_static_attributes( exporting static_attributes = ls_stru ).

    Similarly create event for Radiobutton 2 or You can also use the same event with a little more neat coding.

    Regards,

    Radhika.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Radhika,

      No both of them were strings. I fixed the problem.

      Actually i got how to do this. I took help of a new context attribute. and we have to give different unique value to keytoselect. depending on that i could do it.

        DATA : ITEMS_NODE TYPE REF TO IF_WD_CONTEXT_NODE,
               ITEMLIST TYPE STANDARD TABLE OF IF_MAIN=>ELEMENT_RADIO,
               W_LIST LIKE LINE OF ITEMLIST.
      
        ITEMS_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'RADIO' ).
        ITEMS_NODE->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = ITEMLIST ).
        LOOP AT ITEMLIST INTO W_LIST.
          CLEAR: W_LIST-ACCEPT,
                 W_LIST-DENY.
          IF     W_LIST-SELECTEDKEY = 'a'.
            W_LIST-ACCEPT = 'X'.
          ELSEIF W_LIST-SELECTEDKEY = 'b'.
            W_LIST-DENY  = 'X'.
          ENDIF.
          MODIFY ITEMLIST FROM W_LIST INDEX SY-TABIX.
        ENDLOOP.
      
        ITEMS_NODE->BIND_TABLE( ITEMLIST ).
      
        WD_THIS->FIRE_NEXT_PLG(
        ).
      

      Thanks,

      Sreekanth

  • avatar image
    Former Member
    Jul 09, 2009 at 12:19 PM

    Hi,

    While binding the internal table to node, you need to modify the internal table based on your conditions whne you get back to previous view.

    Regards,

    Lekha.

    Add comment
    10|10000 characters needed characters exceeded