on 10-08-2008 8:18 AM
Hi,
I have a context node dealer and attribute as dealer code.
I have assigned this context to a table.
i want to insert some values into the dealer code field of the table.
when i use the below code, its giving outofbound exception.
for(i=0;i<5;i++)
{
wdContext.nodedealer.getdealerelementatindex(i).setdealercode(i);
}
kindly suggest.
Hi,
You want to append values to your table in addition to the values in the node Dealer. You can do it in many ways one way is iterate a loop say up to 5 and if counter value is greater than your node size then create a element, set element values and then bind to the node.
In action Button
for(int i=0;i<5;i++)
{
if (i>wdContext.nodeDealer.size())
{
IPrivateview.IDealerelement ele = wdContext.createDealerelement();
ele.setDealercode("XYZ");
wdContext.nodeDealer().addElement(ele);
}
}
Hope this will solve your problem, revert me if you have any clarifications
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can use the following code:
IPrivate<View Name>.I<DealerNode>Element elemet = wdContext.node<DealerNode>().create<DealerNode>Element();
elemet.set<DealerAttribute>(<some Value>);
wdContext.node<DealerNode>().addElement(element);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
according to me there is no elements in your table.
if you want to add elements to table do like this,
IPrivate<name>View.InodedealerNode inodedealerNode = wdContext.nodedealer();
IPrivate<name>View.InodedealerElement inodedealerElement =inodedealerNode.creatededealerElement();
inodedealerElement.setCode("1111");
inodedealerNode.addElement(inodedealerElement);
if you have some elements already then follow the Aishwarya Sharma's first post.
Regards,
ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Create One action add and write the following code.
public void onActionAdd(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionAdd(ServerEvent)
for(int j=0;j<=wdContext.nodeTable_1().size();j++)
{
IPrivateAssi3View.ITable_1Element tabadd = wdContext.createTable_1Element();
tabadd.setDept_ID(wdContext.currentTable_1Element().getDept_ID());
tabadd.setName( wdContext.nodeTable_1().addElement(tabadd);
}
//@@end
}
hpe it wl help u.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The above code will work if you already have some values in you node element. If not you may need to create an element of the node, set the values on that element and then bind the element to the node.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
rather then the code for(i=0;i<5;i++)
use for (i = 0; i < wdContext.nodeDealer().size(); i++)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.