on 10-19-2006 1:22 PM
Hi All,
I have a table and have to to multiselection.While doing the multiselection I have to pass the few things for the selected rows to a BAPI which will process and give the output accordingly.
In an action handler I am writing the following code:
//*****Trying the multiselection****//
IOPENITEMS_openElement tableEle = null;
IPrivateCreateResultIPView.IMultiNodeElement ele = wdContext.nodeMultiNode().createMultiNodeElement();
for(int i=0;i<wdContext.nodeOPENITEMS_open().size();i++){
wdComponentAPI.getMessageManager().reportSuccess(" Size is :"+wdContext.nodeOPENITEMS_open().size());
boolean aa = wdContext.nodeOPENITEMS_open().isMultiSelected(i);
wdComponentAPI.getMessageManager().reportSuccess("Selected : "+i " : Val "aa);
if(aa){
wdComponentAPI.getMessageManager().reportSuccess(" Selected "+i);
tableEle = (IOPENITEMS_openElement)wdContext.nodeOPENITEMS_open().getElementAt(i);
ele.setMultiDocno(tableEle.getDOC_NO());
ele.setMultiItem(tableEle.getITEM());
ele.setMultiRep(tableEle.getREP_ITEM());
ele.setMultiSub(tableEle.getSUB_ITEM());
wdContext.nodeMultiNode().addElement(ele);
}
}
//****Ends here***//
here multiNode is a local View node that I have taken to collect the records or the data for the selected rows.
The Exception that i am getting
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(CreateResultIPView.multiNode): cannot bind or add element, because it is already bound to a node
at com.sap.tc.webdynpro.progmodel.context.Node.prepareAddElement(Node.java:645)
at com.sap.tc.webdynpro.progmodel.context.Node.addElement(Node.java:631)
at com.accenture.pct.rrs.installmentplan.CreateResultIPView.onActionCreateInstallmentPlan(CreateResultIPView.java:462)
at com.accenture.pct.rrs.installmentplan.wdp.InternalCreateResultIPView.wdInvokeEventHandler(InternalCreateResultIPView.java:1597)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
Kindly give a solution to the problem.I have been struggling for the past one whole day.
looking forward to you.
Regards
DK
Hi DK,
It is simple. Bring that element into the for loop.like,
IPrivateCreateResultIPView.IMultiNodeElement ele = null;
for(int i=0;i<wdContext.nodeOPENITEMS_open().size();i++){
ele = wdContext.nodeMultiNode().createMultiNodeElement();
//write your logic here
wdContext.nodeMultiNode().addElement(ele);
}
Hope it solved ur problem.Otherwise get back.
Regards,
SK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
int n = wdContext.nodeOPENITEMS_open().size();
wdComponentAPI.getMessageManager().reportSuccess("Size of node OPENITEMS_open: " + n);
for (int i = 0; i < n; i++)
{
boolean selected = wdContext.nodeOPENITEMS_open().isMultiSelected(i) || wdContext.nodeOPENITEMS_open().getLeadSelection() == i;
if (selected)
{
wdComponentAPI.getMessageManager().reportSuccess("Element at index " + i + " is selected");
IOPENITEMS_openElement src = wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(i);
IMultiNodeElement tgt = wdContext.nodeMultiNode().createMultiNodeElement();
wdContext.nodeMultiNode().addElement(tgt);
tgt.setMultiDocno(src.getDOC_NO());
tgt.setMultiItem(src.getITEM());
tgt.setMultiRep(src.getREP_ITEM());
tgt.setMultiSub(src.getSUB_ITEM());
}
}
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.