Skip to Content

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

radio button in web dynpro

Hello..

I was playing around the UI elements of web dynpro . I want to display three radio buttons on the screen for three colors and after that I have a submit button below it.

Later on I will write some logic under the button submit onaction method, but for now I am struggling with the radio button.

I have added RADIOBUTTONGROUPBYINDEX element to my layout and I see the three radio buttons added without any captions. I got stuck here. How to give the captions to the radio button ?

Thanks for your time.

Peeru.

Former Member
Former Member replied

Hi Indrani,

Create a Node (like RBGRP) with cordinality 0..n and add Attribute(like TEXT1) in context with STRING type.

For RBGRP provide supply function name example (FILL_DESCRIPTION).

add the texts to internal

check below code ..

method FILL_DESCRIPTION .

  • General Notes

  • =============

  • A common scenario for a supply method is to aquire key

  • informations from the parameter <parent_element> and then

  • to invoke a data provider.

  • A free navigation thru the context, especially to nodes on

  • the same or deeper hierachical level is strongly discouraged,

  • because such a strategy may easily lead to unresolvable

  • situations!!

  • if necessary, get static attributes of parent element

  • DATA ls_parent_attributes TYPE wd_this->element_context.

  • parent_element->get_static_attributes(

  • IMPORTING

  • static_attributes = ls_parent_attributes ).

*

    • data declaration

DATA lt_rbgrp TYPE STANDARD TABLE OF IF_MAIN=>Element_rbgrp.

DATA ls_rbgrp LIKE LINE OF lt_rbgrp.

  • @TODO compute values

  • e.g. call a data providing FuBa

ls_rbgrp-TEXT1 = 'Button1'.

INSERT ls_rbgrp into table lt_rbgrp.

ls_rbgrp-TEXT1 = 'Button2'.

INSERT ls_rbgrp into table lt_rbgrp.

ls_rbgrp-TEXT1 = 'Button3'.

INSERT ls_rbgrp into table lt_rbgrp.

  • bind all the elements

node->bind_table(

new_items = lt_rbgrp

set_initial_elements = abap_true ).

*

endmethod.

///Happy coding.

Kiran Singh

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question