on 06-21-2007 1:26 PM
Hi Experts,
What is the difference between Dropdown key and Dropdown index?
Thanks,
P.Manivannan.
Hi Manivannan,
The basic difference between the DDBKEY and DDBI is that if you bind the DDKEY to the context attribute at runtime the attribute will store the key displayed and DDBI's binded attribute will store the value.
What is important to know in this case is when to use them over each other.
Look using DDbyKey is preferable when you importing an RFC where the simple types are getting created at automatically and gets populated on a call so there is no work required from our side and also for dynamic changing values.
DDByIndex are more like showing a list on the UI and so are they populated an attribute of type list is binded and populated at runtime.More used for displaying the static data.
You can find out minor technical details associated with it in SAP Netweaver Documentation.
Regards
Amit
Message was edited by:
Amit Kesari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Manivannan,
For dropdown by Index, we will get the value as index based, from 0 to N-1.
So, we will use node in the context, to store these multiple values of dropdownby index.
ie.One context variable inside a node is bound to DropdownbyIndex.
We will add elements to this node, which will be the elements of DDbyIndex.
In contrast, for Dropdown by key, the values are stored as key-value pair (Similar to a HashMap). So only one context variable of type string is enough for dropdown by key. At runtime, we can put values to this context variable so that it can act like a HashMap. Also, we can define key-value pairs in dictionary at designtime , so that it can be bound to this DDbyKey context variable.
Regards
Fahad Hamsa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manivannan,
Check this links,
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mani,
Dropdown by key:
here used for simple type Static Data's(creating "Enumeration TAB")
here Context Attribute is used
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/5c/1b76bc3da0504e8b535cf3e154eaa7/frameset.htm">DropDownByKey</a>
Dropdown by index
here used for Dynamic data's(creating Run time),
here context node is used
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/5c/1b76bc3da0504e8b535cf3e154eaa7/frameset.htm">DropDownByIndex</a>
Regards,
vino
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
DropdownKey--> creating the simple type-> enumeration ,u can insert the datas into the dropdown box
DropdownIndex----> u have to write dynamic coding to insert the datas into the dropdown box
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Drop down by key contains values like(Approve) and this value "Approve" is mapped to a key value ("A"). These mapping is done using ValueSet
In case of drop down by index.. it only contains values which are indenfied by their index poisitions.
Let me know if you need code.
Thnaks
Avijit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
<b>DropdownbyIndex:</b>
http://help.sap.com/saphelp_nw70/helpdata/en/dd/b0884118aa1709e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/3b/f1754276e4c153e10000000a1550b0/frameset.htm
<b>DropDownByKey:</b>
http://help.sap.com/saphelp_nw70/helpdata/en/c5/e4884180951809e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/08/13dbfb6e779743bb2ca641ebcb3411/frameset.htm
<b>Code Example:</b>
http://help.sap.com/saphelp_nw70/helpdata/en/95/93fe1e71a2e44691b1f041e67f71aa/frameset.htm
Hi Balaji,
Here is a sample code for DDBIndex(Place it in DoModifyView() method),
In this scenario, there is a node named 'Degree' in the context of 'Forum' View, which is bound to DDBIndex UI Element.
IPrivateForumView.IDegreeElement degelement1 = wdContext.nodeDegree().createDegreeElement();
degele0.setDegree("School");
wdContext.nodeDegree().addElement(degelement1);
IPrivateForumView.IDegreeElement degelement2 = wdContext.nodeDegree().createDegreeElement();
degele0.setDegree("UG");
wdContext.nodeDegree().addElement(degelement2);
IPrivateForumView.IDegreeElement degelement3 = wdContext.nodeDegree().createDegreeElement();
degele0.setDegree("PG");
wdContext.nodeDegree().addElement(degelement3);
OR
You can place the code for inserting elements to the node, into a loop, which can reduce the burden of coding.
For DDBKey, You have to just bind the DDBKey UI Element, to the corresponding context node, which has dictionary structure binding.
Regards,
Prabhakar.
Hi,
Context
-DDBKNode (node)
---Key (attribute)
---Value (attribute)
The selected.Key property of DropDownByKey is mapped to Attribute "Value"
IWDAttributeInfo atrInfo = wdContext.nodeDDBKNode().getNodeInfo().getAttribute("Value");
IModifiableSimpleValueSet ValueSet = atrInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
// ValueSet.put("Default","Select a value"); // if you want a default value
for(int i = 0; i < wdContext.nodeDDBKNode().size();i++)
{
ValueSet.put(wdContext.nodeDDBKNode().getDDBKNodeElementAt(i).getKey(), wdContext.nodeDDBKNode().getDDBKNodeElementAt(i).getValue());
}
Hi,
you can also use DDBI instead of DDBK provided the key and value attributes are under the same node.Only thing is their is a null value at the start of the DDBI.
Say you have context structure as
Context
-DDBKNode (node)
---Key (attribute)
---Value (attribute)
Then map "texts" property of DropDownByIndex to Attribute "Value" fo the node DDBKNode
In your action where you want to get the Key of the selected value in the dropdownbyindex
if(wdContext.nodeDDBKNode.getLeadSelection()==-1) // check if the null value of DDBI is selected
{// if the null value of DDBI is selected display a message
wdComponentAPI.getMessageManager().reportException("Error Message",false);
}
else
{
wdContext.currentDDBKNodeElement.getKey(); // this will give you the key of the selected value.
}
Hi,
DropDownByKey has a key associated with every value that is shown in the dropdown (key value pair) while DropDownByIndex has Index associated with every value of it.
When you get the lead selection in DDBI you get the index of the element where as in case of DDBK you get the key value of the element.
To populate values in the DDBK you need to modify the attribute and code yourself
where as in case of DDBI you associate the attribute with DDBI property.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.