on 04-26-2006 11:32 PM
Hello All,
I need to set a DropDownByIndex using values that comes from a Bapi. Actually I load the DropDownByIndex using a Context structure, but would like to set the selection according to the Bapi value of the field.
For example
My DropDownByIndex include these values:
US USA
GT UK
CA Canada
So if I receive from the Bapi GT I should show in the DropDownByIndex UK.
I saw the documentation to set the DropDownByIndex using the index, but I would like to know if its possible to do it in this way.
Thanks in advance
Alexis
Hi Alexis:
This link to a tutorial explains you, that you need, it´s also a tutorial of DropDown in Web Dynpro
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/value help in web dynpro applications.pdf
Good luck!!!
Regards
Joshua
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Following the code snippet which may help you out.
Create a context
Node Country
Element CountryName
Create a hash map
HashMap hm = new HashMap();
iterate thrugh the node and populate the hash map.
ITestController.ICountryElement element = wdContext.createCountryElement();
IWDAttributeInfo wdAtrrInfo = wdContext.nodeCountry().getNodeInfo().getAttribute(IPublicTestController.ICountryElement.SELECTED_COUNTRY_ID);
ISimpleTypeModifiable myType=wdAtrrInfo.getModifiableSimpleType();
IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();
if(hm != null)
{
Iterator objIterator = hm.keySet().iterator();
while(objIterator.hasNext())
{
String Key = objIterator.next().toString();
String Value = hm.get(Key).toString();
values.put(Key,Value);
}
}
wdContext.nodeRootID().addElement(element);
wdContext.currentRootIDElement().setSelectedRootID("GT");
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
The problem is that I have the values in a Model Node which contains the result of the Bapi with the list of Countries, so how can I fill the dropdownlist from this context structure.
Regards,
Alexis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alexis,
If you want to find the value by the key, you need to use the drop down by key. But to do that you need to populate a simple type with the key/value pairs. When the list is already in a node, I find it is easier to use the drop down by index and bind it to the node attribute you want displayed. Then you can get the selected index of the node and get to the selected element that way.
-Cindy
Hi All,
The problem is that I'm havings the values in a Model Node where I have the list of Countries, so how can I fill the dropdownlist from the structure.
Regards,
Alexis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Iterate through the node elements until you find the index of the "GT" entry, set the lead selection of the node to this index.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alexis,
I think u cant do so in DD by index. It will display the value in the DD and what ever u select it
will get displayed. If the values that comes from a Bapi
is like key and value, then u can Dynamically assign a simple data type Simple Type to a value attribute at runtime, Bind it to a Input Field, this will return u only the key ,since u want to display the text, it can be achived by Calculated Context Attribute.
Check this link for more infohttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/yet another evs valuehelp - showing display texts for keys.article
Regards,
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.