cancel
Showing results for 
Search instead for 
Did you mean: 

default radiobuttongroupbykey

former_member210967
Participant
0 Kudos

Hi All,

How can I default e.g. on the 1st entry of a radio button group by key if the groups exists of e.g. 2 items, See the code below for the definition of the radiobuttongroupbykey.

Cheers, John

METHOD wddoinit .

*& Begin Radiobuttongroup by key

DATA: lr_node_info TYPE REF TO if_wd_context_node_info,

ls_value TYPE wdy_key_value,

lt_value_set TYPE wdy_key_value_table.

*&- Create value-key

ls_value-key = 'UA Plan'.

ls_value-value = 'UA Plan'.

APPEND ls_value TO lt_value_set.

ls_value-key = 'UI Plan'.

ls_value-value = 'UI Plan'.

APPEND ls_value TO lt_value_set.

*&- Retrieve Node

lr_node_info = wd_context->get_node_info( ).

lr_node_info = lr_node_info->get_child_node( 'DEFINE_PLANBUILD' ).

*&- Set attribute info

lr_node_info->set_attribute_value_set( name = 'PLAN'

value_set = lt_value_set ).

*& End Radiobuttongroup by key

ENDMETHOD.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member210967
Participant
0 Kudos

solved

Former Member
0 Kudos

Hi,

Use set_attribute method of if_wd_context_node.

Set the attribute binded to Radiobutton Group with the key. It will work.

former_member210967
Participant
0 Kudos

Hi

I added:

lr_node = wd_context->get_child_node( name = 'DEFINE_PLANBUILD' ).

lr_node->set_attribute( index = 1

name = 'PLAN'

value = 'UA Plan' ).

but does not work. Do I forgot something ?

Former Member
0 Kudos

Hi,

Data Binding in RadioButtonGroupByKey works in differenet way as in normal type of binding, here either the value is automaically determined from underlying Domain Values and those many radio buttons are created.

To define your own set of values as you want, you need to call method set_attribute_value_set of interface if_wd_context_node_info .

a) create an attribut of type string

b) set the selectedkey prop to this attribute

c) get your node reference

d) for the node get the node info reference.

e) call above mentioned method to assign a value set to created attribute

f) in attribute properties set the param DEFAULT VALUE to one of the values of you value set ( any of the key values )

Coding will be something like this for node info part

data: lo_node_info TYPE REF TO if_wd_context_node_info.

lo_node_info = wd_context->GET_NODE_INFO( ).

CALL METHOD LO_NODE_INFO->SET_ATTRIBUTE_VALUE_SET

EXPORTING

NAME = 'SELECTED_KEY'

VALUE_SET = lt_rbt_key

.

where lt_rbt_key is of type wdy_key_value and is filled the same way as you filled it.

here selected_key is my attribute and is directly created below context , that is why node is wd_cotnext.

Hope this helps

Manas Dua

Former Member
0 Kudos

Check [KeyBinding|http://help.sap.com/saphelp_nw04s/helpdata/EN/bb/69b441b0133531e10000000a155106/frameset.htm] section

Oops; seems like I explained unnecessarily, you already did the node info set attribute value stuff

Just set the default value then in attribute properties..

Edited by: Manas Dua on Mar 26, 2010 2:03 PM

former_member210967
Participant
0 Kudos

solved by myself.

In the component controller the 'TYPE' must of field 'PLAN' mustbe of type String.

If I had choosen a DDICT domein the the 'TYPE' had to refer to the data element. WIth 'Default' then I could fill in the default value from the domain list. No I have filled in e.g. 'UA' for the default key.

Edited by: John Maas on Mar 31, 2010 6:44 AM