cancel
Showing results for 
Search instead for 
Did you mean: 

how to call a radiobutton from radiobutton and how to add in webdynpro abap

Former Member
0 Kudos
137

first i have created my first radio buttonkey rgp and nrgp.my requirement is that when i selected RGP radiobutton then then another radiobutton group PO and NON PO is opened..how to do that in webdynpro abap..Please its very urgent ..see the attached photo

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

can someone tell me how to do that by briefly with screenshot with step by step..

its very urgent

Former Member
0 Kudos

Hi Kaustav,

As per your snapshot,

1) Create two radio button groups

    Group-1 containing radio buttons

      RGP

      NGRP

     Group-2 containing radio buttons

       PO   ( Where in you need to bind the visibility of this radio button to boolean attribute)             

      NON-PO ( Where in you need to bind the visibility of this radio button to boolean attribute)

2) Now on selecting RGP radio button,set the boolean attribute visibility to ABAP_TRUE. Then two radio buttons as per your requirement will be visible.

ie.    IF   RG_RDP = 'X'. " Radio button RGP is selected.

            

           LO_EL_<NODENAME>->SET_ATTRIBUTE( NAME   = ' BOOLEAN ATTRIBUTE NAME'

                                                                                    VALUE = ABAP_TRUE ).

        ENDIF.

Hope this helps you.

Thanks

KH

Former Member
0 Kudos

yes i understand..but i need proper step with screenshot..means i need which context and which method i have to write the code

Former Member
0 Kudos

Hi,

You need to write code in onselect event of radio buttton group.

Thanks

KH

Former Member
0 Kudos

yes i need the complete step..bcoz i am new in webdynpro abap..please give me screenshot with step by step that will be helpful for me

Former Member
0 Kudos

Hi,

Browse through the below links which will helps you to understand better.

Displaying text and radio button using WebDynpro for ABAP

Radio Button Group By Key

Thanks

KH

Former Member
0 Kudos

Hi Kaustav,

As per your snapshot,

1) Create two radio button groups

    Group-1 containing radio buttons

      RGP

      NGRP

     Group-2 containing radio buttons

       PO   ( Where in you need to bind the visibility of this radio button to boolean attribute)            

      NON-PO ( Where in you need to bind the visibility of this radio button to boolean attribute)

2) Now on selecting RGP radio button,set the boolean attribute visibility to ABAP_TRUE. Then two radio buttons as per your requirement will be visible.

ie.    IF   RG_RDP = 'X'. " Radio button RGP is selected.

           

           LO_EL_<NODENAME>->SET_ATTRIBUTE( NAME   = ' BOOLEAN ATTRIBUTE NAME'

                                                                                    VALUE = ABAP_TRUE ).

        ENDIF.

Hope this helps you.

Thanks

KH

IN THE ABOVE CODE SHOWING SOME ERROR..HOW TO RESOLVE IT

Former Member
0 Kudos

DEAR EXPERTS,


method ONACTIONONREAD .

      DATA lo_nd_radio_a TYPE REF TO if_wd_context_node.

      DATA lo_el_radio_a TYPE REF TO if_wd_context_element.

      DATA ls_radio_a TYPE wd_this->Element_radio_a.

*    navigate from <CONTEXT> to <RADIO_A> via lead selection

      lo_nd_radio_a = wd_context->get_child_node( name = wd_this->wdctx_radio_a ).

*    @TODO handle non existant child

*    IF lo_nd_radio_a IS INITIAL.

*    ENDIF.

*    get element via lead selection

      lo_el_radio_a = lo_nd_radio_a->get_element( ).

*    @TODO handle not set lead selection

**     IF lo_el_radio_a IS INITIAL.

**     ENDIF.

*    get all declared attributes

      lo_el_radio_a->get_static_attributes(

        IMPORTING

          static_attributes = ls_radio_a ).

   DATA lo_nd_radio_b TYPE REF TO if_wd_context_node.

   DATA lo_el_radio_b TYPE REF TO if_wd_context_element.

   DATA ls_radio_b TYPE wd_this->Element_radio_b.

* navigate from <CONTEXT> to <RADIO_B> via lead selection

   lo_nd_radio_b = wd_context->get_child_node( name = wd_this->wdctx_radio_b ).

* @TODO handle non existant child

* IF lo_nd_radio_b IS INITIAL.

* ENDIF.

* get element via lead selection

   lo_el_radio_b = lo_nd_radio_b->get_element( ).

  IF  LS_RADIO_A-RADIO1 = ' X '. " Radio button RGP is selected.

    LO_EL_RADIO_B->SET_ATTRIBUTE( NAME = ' radio3 ' VALUE = ABAP_TRUE ).

**elseif ls_radio_A-radio2 = ' x '.

**

**     lo_el_radio_b->set_attribute( name =  'radio4' value = abap_false ).

  ENDIF.

* @TODO handle not set lead selection

**  IF lo_el_radio_b IS INITIAL.

**  ENDIF.

* get all declared attributes

   lo_el_radio_b->get_static_attributes(

     IMPORTING

       static_attributes = ls_radio_b ).



AFTER WRITTING THIS CODE if i not selecting anything it is showing that po and non po radio button..see below image

Former Member
0 Kudos

Hi Kaustav,


AFTER WRITTING THIS CODE if i not selecting anything it is showing that po and non po radio button..see below image

Initially in WDDOINIT( ) method of that corresponding view,set the visibility of that radio buttons to abap_false i.e set its visibility to none.

Thanks

KH

Former Member
0 Kudos

dear hawkins,

can you explain me properly..i am confused

Former Member
0 Kudos

Hi Kastav,

In WDDOINIT( ) method of that view(in which you have radio buttons) set the visibility of  PO,NON-PO radiobuttons to abap_false( i.e invisibile).

Purpose : Initially  as you want to hide that radio buttons and based on your condition enable( set visibility as abap_true( visible) ) .

Thanks

KH

Former Member
0 Kudos

DEAR HAWKINS,

                                          how can i solve it..pleasee help me to  resolve this


select of first radio buttoon rgp method,

method ONACTIONON_SELECT .

   DATA lo_nd_radio_a TYPE REF TO if_wd_context_node.

   DATA lo_el_radio_a TYPE REF TO if_wd_context_element.

   DATA ls_radio_a TYPE wd_this->Element_radio_a.

   DATA lv_radio1 TYPE wd_this->Element_radio_a-radio1.

   DATA lo_el_context TYPE REF TO if_wd_context_element.

   DATA ls_context TYPE wd_this->Element_context.

   DATA lv_visibility TYPE wd_this->Element_context-visibility.

* navigate from <CONTEXT> to <RADIO_A> via lead selection

   lo_nd_radio_a = wd_context->get_child_node( name = wd_this->wdctx_radio_a ).

* @TODO handle non existant child

* IF lo_nd_radio_a IS INITIAL.

* ENDIF.

* get element via lead selection

   lo_el_radio_a = lo_nd_radio_a->get_element( ).

* alternative access  via index

* lo_el_radio_a = lo_nd_radio_a->get_element( index = 1 ).

* @TODO handle not set lead selection

**  IF lo_el_radio_a IS INITIAL.

**  ENDIF.

* get single attribute

   lo_el_radio_a->get_attribute(

     EXPORTING

       name `RADIO1`

     IMPORTING

       value = lv_radio1 ).

* get element via lead selection

   lo_el_context = wd_context->get_element( ).

   IF lv_radio1 = 'x'.

     lv_visibility = 02.

   else.

     lv_visibility = 01.

   ENDIF.

* @TODO handle not set lead selection

**  IF lo_el_context IS INITIAL.

**  ENDIF.

* @TODO fill attribute

* lv_visibility = 1.

* set single attribute

   lo_el_context->set_attribute(

     name `VISIBILITY`

     value = lv_visibility ).

endmethod.



select of second radio button nrgp

method ONACTIONON_SELECT1 .

      DATA lo_nd_radio_a TYPE REF TO if_wd_context_node.

      DATA lo_el_radio_a TYPE REF TO if_wd_context_element.

      DATA ls_radio_a TYPE wd_this->Element_radio_a.

*    navigate from <CONTEXT> to <RADIO_A> via lead selection

      lo_nd_radio_a = wd_context->get_child_node( name = wd_this->wdctx_radio_a ).

*    @TODO handle non existant child

*    IF lo_nd_radio_a IS INITIAL.

*    ENDIF.

*    get element via lead selection

      lo_el_radio_a = lo_nd_radio_a->get_element( ).

       ls_radio_A-key_to_select = ' x '.

       ls_radio_A-radio1 = '  '.

       ls_radio_A-radio2 = ' x '.

*    @TODO handle not set lead selection

**     IF lo_el_radio_a IS INITIAL.

**     ENDIF.

*    @TODO fill static attributes

*    ls_radio_a = xxx->get_yyy( ).

*    set all declared attributes

      lo_el_radio_a->set_static_attributes(

         static_attributes = ls_radio_a ).

endmethod.

and THE WDDOINIT METHOD

method WDDOINIT .

      DATA lo_nd_radio_a TYPE REF TO if_wd_context_node.

      DATA lo_el_radio_a TYPE REF TO if_wd_context_element.

      DATA ls_radio_a TYPE wd_this->Element_radio_a.

      DATA lv_radio1 TYPE wd_this->Element_radio_a-radio1.

*    navigate from <CONTEXT> to <RADIO_A> via lead selection

      lo_nd_radio_a = wd_context->get_child_node( name = wd_this->wdctx_radio_a ).

*    @TODO handle non existant child

*    IF lo_nd_radio_a IS INITIAL.

*    ENDIF.

*    get element via lead selection

      lo_el_radio_a = lo_nd_radio_a->get_element( ).

       ls_radio_A-key_to_select = ' x '.

       ls_radio_A-radio1 = ' x '.

       ls_radio_A-radio2 = '  '.

*    @TODO handle not set lead selection

**     IF lo_el_radio_a IS INITIAL.

**     ENDIF.

*    @TODO fill static attributes

*    ls_radio_a = xxx->get_yyy( ).

*    set all declared attributes

      lo_el_radio_a->set_static_attributes(

         static_attributes = ls_radio_a ).

*      navigate from <CONTEXT> to <RADIO_A> via lead selection

        lo_nd_radio_a = wd_context->get_child_node( name = wd_this->wdctx_radio_a ).

*      @TODO handle non existant child

*      IF lo_nd_radio_a IS INITIAL.

*      ENDIF.

*      get element via lead selection

        lo_el_radio_a = lo_nd_radio_a->get_element( ).

*      alternative access  via index

*      lo_el_radio_a = lo_nd_radio_a->get_element( index = 1 ).

*      @TODO handle not set lead selection

*       IF lo_el_radio_a IS INITIAL.

*       ENDIF.

*      get single attribute

        lo_el_radio_a->get_attribute(

          EXPORTING

            name `RADIO1`

          IMPORTING

            value = lv_radio1 ).

endmethod...

Former Member
0 Kudos

Can you provide ST22 dump analysis snap shot.

Thanks

KH

Former Member
0 Kudos

yaa sure Hawkins  i am sending the attached dump error file

ramakrishnappa
Active Contributor
0 Kudos

Hi Kaustav,

You can achieve your requirement as below

  • Create 2 radio buttons RGP & NRGP  and create a transparent container TC_RADIO_RGP below  i.e. tc_radio_rgp contains the radio buttons PO & NON PO
  • Now, create a context attribute VISIBLE_TC_RADIO_RGP of type WDUI_VISIBILITY and bind the property VISIBLE of tc_radio_rgp
  • On select action of radio button RGP, you can set the attribute VISIBLE_TC_RADIO_RGP to '02' and the radio buttons under RGP shown.

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

can you briefly explain me with screenshot step by step..that will help for me..I am getting error. can u give me some screen shot of that.