cancel
Showing results for 
Search instead for 
Did you mean: 

Radio button logic help required

murali_ram
Participant
0 Kudos

Hi Guru's

Am developing a wdy screen with radio button options. ( Using Radio button group by key )

I have two set of radio buttons.

one is header..based on the header the 2nd set of radio button should enable by default.

this is dataelement which am using for both set of radio button

dataelement for first set ( ie)1. Extruder,2. Silosample,3. both

data element for 2nd set (ie)1. batch ,2.period

attribute in context node. :    sample is an attribute for first set of radio buttons

                                           options is an attribute for second set.

My Requirement is :When i press Silo sample radio button of group 1.... the period radio button of group2 should enable default...and also when i goes  to select batch of the same group...it should move to batch radio button.

Herewith i have attached my code... Please help to modify.

method ONACTIONRBI_MAIN .

DATA lo_nd_rib_main TYPE REF TO if_wd_context_node.

DATA lo_el_rib_main TYPE REF TO if_wd_context_element.
DATA ls_rib_main TYPE wd_this->Element_rib_main.
DATA lv_sample TYPE wd_this->Element_rib_main-sample.
DATA lv_options TYPE wd_this->Element_rib_main-options.

*   navigate from <CONTEXT> to <RIB_MAIN> via lead selection
lo_nd_rib_main
= wd_context->get_child_node( name = wd_this->wdctx_rib_main ).

*   @TODO handle non existant child
*   IF lo_nd_rib_main IS INITIAL.
*   ENDIF.

*   get element via lead selection
lo_el_rib_main
= lo_nd_rib_main->get_element( ).
*   @TODO handle not set lead selection
IF lo_el_rib_main IS INITIAL.
ENDIF.

*   get single attribute
lo_el_rib_main
->get_attribute(
EXPORTING
name
`SAMPLE`
IMPORTING
value = lv_sample ).

lo_el_rib_main
->get_attribute(
EXPORTING
name
`OPTIONS`
IMPORTING
value = lv_options ).




if lv_sample eq '01' and lv_options eq 'PERIOD'.

lo_el_rib_main
->set_attribute( EXPORTING name = 'OPTIONS' value = 'PERIOD' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_DATE' value = '02' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_SAM_POINT' value = '02' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_BATCH' value = '01' ).

elseif lv_sample eq '01' and lv_options eq 'BATCH'.

lo_el_rib_main
->set_attribute( EXPORTING name = 'OPTIONS' value = 'BATCH' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_DATE' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_SAM_POINT' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_BATCH' value = '02' ).

elseif lv_sample eq '02' and lv_options eq 'BATCH'.
lo_el_rib_main
->set_attribute( EXPORTING name = 'OPTIONS' value = 'BATCH' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_DATE' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_SAM_POINT' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_BATCH' value = '02' ).


elseif lv_sample eq '02' and lv_options eq 'PERIOD'.
lo_el_rib_main
->set_attribute( EXPORTING name = 'OPTIONS' value = 'PERIOD' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_DATE' value = '02' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_SAM_POINT' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_BATCH' value = '01' ).

elseif lv_sample eq '03' and lv_options eq 'BATCH'.
lo_el_rib_main
->set_attribute( EXPORTING name = 'OPTIONS' value = 'BATCH' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_DATE' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_SAM_POINT' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_BATCH' value = '02' ).

elseif lv_sample eq '03' and lv_options eq 'PERIOD'.
lo_el_rib_main
->set_attribute( EXPORTING name = 'OPTIONS' value = 'PERIOD' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_DATE' value = '02' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_SAM_POINT' value = '01' ).
lo_el_rib_main
->set_attribute( EXPORTING name = 'VISIBLE_BATCH' value = '01' ).
endif.


Thanks


Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Murali,

As suggested my Rama,First read the key i.e the radio button which is selected(in group1) and set the value of radio button(S) in group2 as per your requirement.

I cannot able to provide you the logic as it is already provided by Rama...

Thanks

KH

ramakrishnappa
Active Contributor
0 Kudos

Hi Murali,

Hope you are using the RadioButtonGroupByKey ui element to draw radio buttons from domain values.

Here you cannot enable individual radio buttons but you can select the radio button of your choice

Go to the onSelect event handler of SAMPLE radio button group i.e. header radio button group

" Note here KEY is the parameter of your event handler method onSelect

"-------------------------------------------------------------

     data lv_key type string.

          wdevent->get_data(

                    exporting

                         name = 'KEY'

                    IMPORTING

                        value = lv_key ).

case lv_KEY.

     WHEN '01'.

               LV_OPTION = 'BATCH'.

     WHEN '02'. " Silo

               LV_OPTION = 'PERIOD'.

     WHEN OTHERS.

               LV_OPTION = SPACE.

     ENDCASE.

lo_el_rib_main->set_attribute(
EXPORTING
name
`OPTIONS`
value = lv_option ).


"-------------------------------------------------------------

Hope this helps you.


Regards,

Rama