Hi Divya,
From your question what i understand is you want Radio buttons as Group, You can do this in 2 ways,
1. As you said you will have 2 Attributes both as Radio Buttons and When you click on a Particular Radio Button say Button1 the second shoud be set to abap_false in the Event Handler of Button1, similarly when you click on button 2 set button 1 as abap_false
l_ref_radio->set_property_as_string( iv_attr_name = 'Radio1'
iv_value = ' ' ).
But this is not the Method followed, as this is done through coding, and there is a way to group buttons without using Event Handler as below
2. Create an attribute for the Radio Button Redefine the Get_P method
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_radio.
WHEN if_bsp_wd_model_setter_getter=>fp_radio_cols.
rv_value = 2.
WHEN if_bsp_wd_model_setter_getter=>fp_group.
rv_value = 'R1'.
ENDCASE.
Now this will change the attribute into a Radio Button with 2 Buttons supported and Group Name will be R1
Now in GET_V Method Define all the Buttons Required
Before doing this Declare an Atrribute g_ref_radio of Type CL_CRM_UIU_DDLB in the context class
and add the following code in GET_V
DATA: lt_ddlb TYPE bsp_wd_dropdown_table,
ls_ddlb TYPE bsp_wd_dropdown_line.
IF g_ref_radio IS NOT BOUND.
CREATE OBJECT g_ref_radio
EXPORTING
iv_source_type = 'T'.
ls_ddlb-key = 'R1'.
ls_ddlb-value = 'Radio 1'.
APPEND ls_ddlb TO lt_ddlb.
CLEAR : ls_ddlb.
ls_ddlb-key = 'R2'.
ls_ddlb-value = 'Radio 2'.
APPEND ls_ddlb TO lt_ddlb.
g_ref_radio->set_selection_table( lt_ddlb ).
ENDIF.
rv_valuehelp_descriptor = g_ref_radio.
Thanks and Regards
Pratheek