on 02-08-2012 1:24 PM
Hi all,
my webdynpro table contains 3 rows. each row contains one radio button. at a time i should select only one radio button and bydefault the first one should be select.
Thanks,
Sagarika
Hi,
when the view will load, bydefault radio button of first row of webdynrpo table should check. in this part i am facing problem.
in my onaction-method i wrote the down code for 'deselect radio button if i will select other one'.my node is 'paticipants'.
" Uncheck other Radio button if selected
DATA: lo_nd_participants TYPE REF TO if_wd_context_node,
lo_changed_elem TYPE REF TO if_wd_context_element,
lo_elem TYPE REF TO if_wd_context_element,
lt_elem_set TYPE wdr_context_element_set,
ls_chgd_participant TYPE LINE OF wd_this->elements_participants,
ls_participant TYPE LINE OF wd_this->elements_participants.
FIELD-SYMBOLS:
<fs_participant> TYPE LINE OF wd_this->elements_participants.
" Get the changed context row
CALL METHOD wdevent->get_context_element
EXPORTING
name = 'CONTEXT_ELEMENT'
RECEIVING
value = lo_changed_elem.
" Get static attributes
CALL METHOD lo_changed_elem->get_static_attributes
IMPORTING
static_attributes = ls_chgd_participant.
" Navigate from <CONTEXT> to <PARTICIPANTS> via lead selection
lo_nd_participants = wd_context->get_child_node( name = wd_this->wdctx_participants ).
IF lo_nd_participants IS INITIAL.
RETURN.
ENDIF.
" Get all the selected elements from the context
lt_elem_set = lo_nd_participants->get_elements( ).
" Process the elements
LOOP AT lt_elem_set INTO lo_elem.
CALL METHOD lo_elem->get_static_attributes
IMPORTING
static_attributes = ls_participant.
IF ls_participant-prim_userid NE ls_chgd_participant-prim_userid.
ls_participant-admin_ind = abap_false.
lo_elem->set_static_attributes( ls_participant ).
ENDIF.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sagarika,
Basically in the INIT method itself you need to set the property for initial radio button and clear the other two radio buttons . And when you select any radio button code in the action handler should be written such that other two are cleared and only one is selected every time and that action handler should be able to clear other radio buttons selection.
Check if this idea helps.
Hi,
Try using this
DATA LO_ND_participant TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_participant TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_participant TYPE WD_THIS->ELEMENT_participant.
DATA LT_participant TYPE WD_THIS->ELEMENTS_participant.
data ind type index.
* navigate from <CONTEXT> to <participant> via lead selection
LO_ND_participant = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_participant ).
* @TODO handle not set lead selection
IF LO_ND_participant IS INITIAL.
ENDIF.
* get element via lead selection
LO_EL_participant = LO_ND_participant->GET_ELEMENT( ).
* @TODO handle not set lead selection
IF LO_EL_participant IS INITIAL.
ENDIF.
data : ele_set type ref to if_wd_context_element.
CALL METHOD WDEVENT->GET_CONTEXT_ELEMENT
EXPORTING
NAME = 'CONTEXT_ELEMENT'
RECEIVING
VALUE = ele_set .
data : ind type index.
CALL METHOD ELE_SET->GET_INDEX
RECEIVING
MY_INDEX = ind
.
CALL METHOD LO_ND_participant->GET_STATIC_ATTRIBUTES_TABLE
* EXPORTING
* FROM = 1
* TO = 2147483647
IMPORTING
TABLE = lt_participant
.
loop at lt_participant into ls_participant.
if sy-tabix = ind.
ls_participant-admin_id = ''. " Radio button selected
else.
ls_participant-admin_id = 'X'. "Radio button not selected
endif.
modify lt_participant from ls_participant TRANSPORTING admin_id.
endloop.
lo_nd_participant->bind_table( lt_participant ).
Hi harshith,
Thanks a lot. It worked perfectly for me.
Regards,
Sagarika
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sagarika,
I hope you already changed the column of table UI to radio button. Now create an action for onselect of radio button,
In the method of onSelect of Radio button,
You read the table using, get_static_attributes_table method of node.
Now loop your internal table, if two radio buttons are selected, display error message.
like
loop at lt_tab into ls_tab.
if ls_tab-radio = 'X'.
count = count + 1.
endif.
endloop.
if count > 1.
display error message using report_error_message of message manager.
endif.
Hope this helps u.,
revert for further clarifications.,
Thanks & Regards,
Kiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sagarika,
Can you please mention the problem you are facing or whether you are getting any error, so that
any one could help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.