cancel
Showing results for 
Search instead for 
Did you mean: 

how to make radio button by key in webdynpro

amber_garg
Active Participant
0 Kudos

Hi,

I am new to dynpro. I created a UI element RADIOBUTTON GROUP BY KEY. I bound the SELECTEDKEY property of it to the attribute of string type. Now in my WDDOINIT , i need to fill the values in the attribute right??? . So shall i use SET_ATTRIBUTE or BIND_TABLE or any other function to fill the values in the attrbiute???

I tried but am not successfull.

THANKS

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

here is the code for the same.

data l_nd_inf type ref to if_wd_context_node_info.
  data l_nd type ref to if_wd_context_node.
  DATA L_WA TYPE WDR_CONTEXT_ATTR_VALUE.
  DATA LT_WA TYPE TABLE OF WDR_CONTEXT_ATTR_VALUE.
  l_nd = wd_context->get_child_node( 'FILL' ).              "NODE NAME OF THE NODE HAVING THE ATTRIBUTE 
  L_ND_INF = L_ND->GET_NODE_INFO( ).
  L_WA-TEXT = 'X'.
  L_WA-VALUE = 'V1'.
  APPEND L_WA TO LT_WA.
    L_WA-TEXT = 'y'.
  L_WA-VALUE = 'V2'.
  APPEND L_WA TO LT_WA.
    L_WA-TEXT = 'Z'.
  L_WA-VALUE = 'V3'.
  APPEND L_WA TO LT_WA.
    L_WA-TEXT = 'A'.
  L_WA-VALUE = 'V4'.
  APPEND L_WA TO LT_WA.

  L_ND_INF->SET_ATTRIBUTE_VALUE_SET(
  NAME = 'X1'                        "ATTRIBUTE NAME
  VALUE_SET = LT_WA
   ).

thanks

sarbjeet

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

method WDDOINIT.

  data: lr_node_info type REF TO if_wd_context_node_info.
  data: lo_nd_search type REF TO if_wd_context_node.
  data: ls_valueset type wdr_context_attr_value.
  data: lt_valueset type TABLE OF wdr_context_attr_value.

  lo_nd_search = wd_context->get_child_node( name = 'SEARCH_CRITERIA' ).  "Node Name

  CALL METHOD lo_nd_search->get_node_info
    receiving
      node_info = lr_node_info .


  ls_valueset-value = 'All'.
  ls_valueset-text = 'Display All'.
  append ls_valueset to lt_valueset.

  ls_valueset-value = 'Limit'.
  ls_valueset-text = 'Limit'.
  append ls_valueset to lt_valueset.

  ls_valueset-value = 'Add'.
  ls_valueset-text = 'Add'.
  append ls_valueset to lt_valueset.

  CALL METHOD lr_node_info->set_attribute_value_set
    EXPORTING
      name      = 'SEARCH'   "Attribute Name binded to selected key property of Radiobuttongroupbykey
      value_set = lt_valueset.

endmethod.

To make a radiobutton selected by default, set the property of the context attribute to key value

Default Value - 'All' (Key value)

Regards,

Bala Baskaran.S

gill367
Active Contributor
0 Kudos

It is similar to dropdown by key.

so fill the valueset of the attribute as you fill the case of the dropdown by key.

thanks

sarbjeet