on 10-18-2006 3:05 PM
Hi All,
I am still having the problem with the multilead selection in a table.
I am setting the table properties to multi and I have an event handler for the onaction property, named as leadselection.
I am writing the code below for the event handler.
public void onActionLeadSelect(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
int selectedRow = firstNode.nodeOPENITEMS_open().getLeadSelection();
int sizeOfOpen = wdContext.nodeOPENITEMS_open().size();
IOPENITEMS_openElement element = (IOPENITEMS_openElement)firstNode.nodeOPENITEMS_open().getElementAt(selectedRow);
for(int i=0;i<wdContext.nodeOPENITEMS_open().size();i++){
if(wdContext.nodeOPENITEMS_open().isMultiSelected(i)||selectedRow == i){
wdContext.currentContextElement().setMultiDocNumber(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getDOC_NO());
wdContext.currentContextElement().setMultiItemno(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getITEM());
wdContext.currentContextElement().setMultiRepItem(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getREP_ITEM());
wdContext.currentContextElement().setMultiSubitem(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getSUB_ITEM());
}
}
}
What i am trying to do is..On multiselection or on single leaad selection, I should pass the whole amount to the BAPI or the amount related to only the leadselection.
But when I am trying to run..this code..I am nt able to select in a multiple way..and more over if I press ctrl then I am able to make the other rows highlighted with orange color..but not normally and after making them highlighted also i am not able to pass the amount for all the selected rows..together..
Kindly suggest me..something..
Regards
DK
Hi,
Try this ,
for(int i=0;i<wdContext.nodeOPENITEMS_open().size();i++){
if(wdContext.nodeOPENITEMS_open().isMultiSelected(i)){
wdContext.currentContextElement().setMultiDocNumber(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(i).getDOC_NO());
wdContext.currentContextElement().setMultiItemno(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(i).getITEM());
wdContext.currentContextElement().setMultiRepItem(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(i).getREP_ITEM());
wdContext.currentContextElement().setMultiSubitem(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(i).getSUB_ITEM());
}
}
If you use the selectedRow variable in if condition, it will fetch only one row from table. Because the getLeadSelection() method gives the number of row which got selection on first click before pressing Ctrl key. So you can get only one value for leadselect. that's why the if loop failure for other selected rows.
regards
karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the below code. Not in Lead Selection.
ITableElement tableEle = null;
wdComponentAPI.getMessageManager().reportSuccess(" Size is :"+wdContext.nodeTable().size());
for(int i=0;i<wdContext.nodeTable().size();i++){
boolean aa = wdContext.nodeTable().isMultiSelected(i);
wdComponentAPI.getMessageManager().reportSuccess("Selected : "+i " : Val "aa);
if(aa){
tableEle = (ITableElement)wdContext.nodeTable().getElementAt(i+1);
wdComponentAPI.getMessageManager().reportSuccess("Lead Selected Val " + tableEle.getName());
}
aa=false;
}
Regards,
Sridhar K
Hi DK,
Keep Your Logic in a Separate method(lets say getAmount()) not on LeadSelection Action Method.
Call this method before sending it to the BAPI.
Other wise every time it takes first row amount only.
If your not sure, print that amount in your method.
In your getAmount()
use the below code
ITableElement tableEle = null;
for(int i=0;i<wdContext.nodeTable().size();i++){
boolean aa = wdContext.nodeTable().isMultiSelected(i);
if(aa){
wdComponentAPI.getMessageManager().reportSuccess(" Selected "+i);
tableEle = (ITableElement)wdContext.nodeTable().getElementAt(i+1);
}
}
Regards,
Sridhar K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Try this
for(int i=0;i<wdContext.nodeOPENITEMS_open().size();i++){
<i>if(wdContext.nodeOPENITEMS_open().isSelected(i))</i>{
wdContext.currentContextElement().setMultiDocNumber(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getDOC_NO());
wdContext.currentContextElement().setMultiItemno(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getITEM());
wdContext.currentContextElement().setMultiRepItem(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getREP_ITEM());
wdContext.currentContextElement().setMultiSubitem(wdContext.nodeOPENITEMS_open().getOPENITEMS_openElementAt(selectedRow).getSUB_ITEM());
}
}
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.