cancel
Showing results for 
Search instead for 
Did you mean: 

Getting dropdown data from JavaBean to Web Dynpro

Former Member
0 Kudos

Hi,

I am getting data as Map in Command Bean from the EJB for the dropdown list box to display as Key/Value pair. I want to set that data to the dropdown field which is in Web Dynpro. I couldn't find how to set the propeties after importing model class into Web Dynpro.

Please let me know if any body knows this solution.

Tats

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

There are two flavors of drop-down lists: DropDownByKey and DropDownByIndex.

In the ByKey variant, you have to provide a DDIC type with a value set that contains the key/value pairs. The drop-down list is then bound against a context attribute of that type.

In the ByIndex variant, you have to provide a context node with elements storing the values, the selection is given by the nodes's lead selection and you have to determine the key from this index.

Have a look at both variants and decide what's easier to use in your application.

Armin

sridhar_k2
Active Contributor
0 Kudos

Hi,

Try with this code. First get the MAP from Model and set individual value programmatically to Drop DownByKey in the below way.

//contextElement.empCode - Drop Down Mapped Context Value

IContextElement contextElement = wdContext.currentContextElement();

IWDNodeInfo nodeInfo = wdContext.getNodeInfo();

IWDAttributeInfo dateAttributeInfo = nodeInfo.getAttribute(contextElement.empCode);

IModifiableSimpleValueSet dropValueSet = dateAttributeInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();

String empCodeTxt=null;

//Gives the Size of the List, which is coming from Model

int nodeLength = wdContext.nodeResult().size();

for (int i = 0; i < nodeLength; i++) {

// Gives the Value, Which you want to show in Drop Down List Box.. Change it according to your need.

empCodeTxt= wdContext.nodeResultNode().get<Parameter>());

dropValueSet.put(empCodeTxt, empCodeTxt);

}

Regards,

Sridhar