cancel
Showing results for 
Search instead for 
Did you mean: 

How to create radiobutton in webdynpro

Former Member
0 Kudos

In my screen we have to enter the material no in I/O Box and click on Create radio button and press ok button means. It should go to Create View..

How to give action code for create radiobutton and where we have to enter the code..

Please post the sample code for giving action to radiobutton.... Tell in step by step process

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

create a context attribute for Material number like MATNR type MATNR.

go to the layout, craeate the input field input field UIelement and bind the VALUE property to the MATNR attribute.

Create the button in layout and give the name as submit and create the actionto it as SUBMIT.

There are different types in radio button-> by key and by index..

create 2 views one for selection screen and other for matieral creation.

Define the plugs and link them using navigation plugs.

How many radio buttons are there..in your requirement...what each one does...

Create a attribute of type CHAR1 ..or any of your defined type

Create a radiobutton group in the LAyout and add the radibuttons to this group by righ click...and assign that to the attribute.

As you have specified, one is for CREATE-.

on the SUBMIT action handler, read the attrinute for matnr and aslo the radiobutton realted one..now you will get the values

using the code wizard (READ->CONTEXTNODE) you will have the code generated.. and fire the plug..

Examples -> WDR_TEST_UI_ELEMENTS and WDR_TEST_EVENTS.

Please specify the requriement clearly...

Regards,

Lekha.

Former Member
0 Kudos

http://prabhuabap.blogspot.com/2012/01/webdynpro.html

this is my design page..

In the Material Box we have to enter the material no and click on Create radio button and press ok means. It should go to Create View..

How to give action code for create and where we have to enter the code..

Please tell in screen shotu2026u2026

Lukas_Weigelt
Active Contributor
0 Kudos

From what you describe I would say put the code in an action handler behind the OK-Button. But what do you mean with "Create View"? Could you technically be more specific what should happen? Are you dynamically creating a new view? Or do you want to navigate? Or is there just some kind of output you want then?

Cheers, Lukas

Former Member
0 Kudos

if u click the ok button it should navigate to create view...

tell the sample code

former_member184578
Active Contributor
0 Kudos

Hi,

onAction of OK button you need to write code,

First read the radio button value.

if it is create,

wd_this->fire_to_create_plg( ). " to_create is the outbound plug . You need to create out bound plug in your view

hope this helps u.,

revert if you need some more clarification.

Thanks & Regards,

Kiran.

Former Member
0 Kudos

how to read radio button value.i need some more explanation..

then where we have to fire onactioncreate otherwise in onactionok...

onactionok means what we have enter tell sample code for create RB..

former_member184578
Active Contributor
0 Kudos

Hi,

When you want to navigate to create view?. when click on Ok button or when selecting radio button..?

If you want to navigate to create view when click on ok button you need to write in OnActionOk. else for radio button also you will have one event called onSelect. You can create an action for that and write your code.

In onActionOk or onActionCreate,

Read the attribute using wizard to which you bind your radio button texts.

Let say you created a node called NODEA with cardinality 0..n and you created attribute TEXT under NODEA and you binded your radiobutton texts to TEXT attribute under node.

Now Read the attribute TEXT under NODEA using wizard.

now it will automatically generate code.

Now lv_text contains the selected radio button text.

if lv_text is create,

Navigate to create view using fire outbound plug.

check this code below,

DATA lo_nd_rdb TYPE REF TO if_wd_context_node.   " here rdb is your node name.

    DATA lo_el_rdb TYPE REF TO if_wd_context_element.
    DATA ls_rdb TYPE wd_this->Element_rdb.
    DATA lv_text TYPE wd_this->Element_rdb-text.

*   navigate from <CONTEXT> to <RDB> via lead selection
    lo_nd_rdb = wd_context->get_child_node( name = wd_this->wdctx_rdb ).

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

*   get element via lead selection
    lo_el_rdb = lo_nd_rdb->get_element( ).
*   alternative access  via index
*   lo_el_rdb = lo_nd_rdb->get_element( index = 1 ).
*   @TODO handle not set lead selection
    IF lo_el_rdb IS INITIAL.
    ENDIF.

*   get single attribute
    lo_el_rdb->get_attribute(
      EXPORTING
        name =  `TEXT`
      IMPORTING
        value = lv_text ).   " this lv_text contains your selected radio button value

if lv_text = 'Create'.

 wd_this->fire_to_create_plg(       " here to_create is the outbound plug name.
   ).

elseif ....

endif.

check this article for navigation demo: [Navigation in WDA|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/308ebfe9-a07a-2c10-e494-9849d50efc88?QuickLink=index&overridelayout=true]

Hope this helps u,

Thanks & Regards,

Kiran.

Former Member
0 Kudos

thanks.i got the result

Answers (0)