cancel
Showing results for 
Search instead for 
Did you mean: 

How to create Dropdown List with Javabean Model

Former Member
0 Kudos

Hi

I have to create a dropdown list ( don't know which one is suitable key/index) from data using Javabean model.I already know simple text box input/output/processing using Javabean model (which I learned from SDN tutorial).

Please help me with the steps of how to do it, what things I need to code/configure in webdynpro and also in Javabean model.

Thanks

Ananda

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ananda,

if I have good understood, you want to fill drop down with data from javabean model. I think that it is more simple with DropDownByIndex:

- import model (specially bean with property you will show in dropdown)

- bind model to controller

- bind context from controller to view

- add DropDownByIndex to your view

- bind "text" property of your DropDownByIndex to property in context you will show

- in wdDoInit method fill context with data

- create action OnSelect with one int parameter (e.g. index)

- map parameter for this action (in wdModifyView).

That is all, now when user select a position from your DropDownList an index is send to your method OnSelect (and lead selection is set on selected element).

Regards

Bogdan

Former Member
0 Kudos

Thank you Mukesh and Bogdan. I am Ananda's colleague and am working with him on this problem.

We are comfortable with the basic processes of importing a model, model binding the component/custom controller context to the model, context mapping view controller to component/custom controller, and binding UI element to the view context. We have worked successfully with aRFC models and seen pretty thorough examples of Web Service models. We are new to JavaBean models and have some basic questions about them.

Can you confirm the following? I have a JavaBean class that calls an EJB to retrieve a list of carriers. My JavaBean defines three properties via its getter/setter methods: carrierid (String), carriername (String), and carriers (Map - maps carrier id to carrier name). JavaBean tools outside of WD recognize all three properties. But the WD import wizard only recognizes the simple/scalar properties, not the Map (or any other Collection type that I have tried). Can you confirm that the WD JavaBean model doesn't recognize Java collections as properties?

Former Member
0 Kudos

Hi Randy,

I suppose you have to define relation and than wizard can recognize the collection property. Try with this <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/0b/c566427e17c253e10000000a1550b0/frameset.htm">link</a>

You have to say wizard what knd of objects are in collection (on Model relationView tab you must define a relation target element type).

regards

Bogdan

Former Member
0 Kudos

Hi Randy,

You can Create the List as return parameter.

Create a Bean class (eg ReturnList)with Serializable. contains the out put parameters belongs to carriers(ie) address etc.

add the bean value to the List inside the business logic

List resultList=new ArrayList();

ReturnList result=new ReturnList();

result.setAddress("XXXX");

...

resultList.add(result);

return resultList;

In the Receiving part type cast the recived List with the Bean

ReturnList result=(ReturnList)xx.getResultList(carrierid ,carriername);

you can get the data.

Kind Regards,

Mukesh.

Former Member
0 Kudos

Hi Randy,

Do you solved the problem?. Please Close the Thread.

Kind Regards

Mukesh.

Former Member
0 Kudos

Dear Ananda,

You can create the Dropdown by Index.

For the javabean Model you should create the model using the import javabean model. you can import the java bean by project or jar files.

Add the module to your Project in the Diagram View using the Data Link.Bind the model to the custom controler or component controler directly. Bind the node to the view from custom controler.

Bind the attribute of node to the dropdown.

Kind Regards

Mukesh.