Skip to Content
avatar image
Former Member

how to create a Dropdown in webdynpro

Hi ,

I am a beginner in Webdynpro , Java . Request you to plz help me ..

My requirements -

1. How to create a dropdownbyindex in a view and populate it with some static values passed to the Context .

2. Upon selection of a value from the dropdown and clicking on the Submit button , how to save the value?

Context -

Node - Season

Attribute - Seasonofyear

Kindly Reply

Thanks in Advance!!

Regards

Smita

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 25, 2008 at 05:39 PM

    Hi smitha,

    Context -

    Node - Season

    Attribute - Seasonofyear

    I had worked out ur same requirement with dropdownbykey and added the following code.

    public void wdDoInit()

    {

    IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateMain.IseasonElement.season);

    ISimpleTypeModifiable sea = attributeInfo.getModifiableSimpleType();

    sea.setFieldLabel("SEASON");

    IModifiableSimpleValueSet valueSet =sea.getSVServices().getModifiableSimpleValueSet();

    valueSet.put(0, AAA);

    valueSet.put(1,BBB);

    valueSet.put(2,CCC);

    }

    I think this may help you.

    Edited by: kandha mugundhan on Sep 25, 2008 7:50 PM

    Edited by: kandha mugundhan on Sep 25, 2008 7:52 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 26, 2008 at 03:01 AM

    Hi smitha,

    Firstly in the view layout in the RootUIContainer

    right click -> select Insert child - > select DropDownByIndex. Bind the Value property

    of dropdown with ur node Seasons- Seasonofyear.

    Then in the implementation write:-

    IPrivat<>View.ISeasonNodeElement Season_element - wdcontext.createseasonElement();

    Season_element.setseasonofyear("Summer"); //insert all the values like using Set method

    wdcontext.nodeSeason().addElement(Season_element);

    This shall populate all the values in the dropdown.

    On selecting a particular value from the dropdown if u want to retrieve

    the value . Bind an event handler with the onSelect Action of dropdown UI

    element. In the event handler just write :-

    String seasonofyr = wdcontext.currentseasionNodeElement().getseasionofyear();

    This strin variable shall collect the value of season currently selected.

    Hoep this helps you.

    Thanks

    Namrata

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 26, 2008 at 03:29 AM

    go thru this link to get an an idea for binding data incase of index and key

    http://help.sap.com/saphelp_nw04/helpdata/en/74/450e8af57065468e88e4b86de47e4b/frameset.htm

    Add comment
    10|10000 characters needed characters exceeded