Skip to Content
avatar image
Former Member

Problem with MultiLeadSelection in a table

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 18, 2006 at 03:09 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi

      Dipendra ,on the leadselectAction()(this action should be in view controller) write this code:

      wdContext.node<yourbapinode>().node<ifanyothernode>().addElement(wdContext.node<yourbapinode>().<ifanyothernode>()().create<ifany node>Element(new <your Bapitableclass>));

      Regards

      Nidhideep

  • avatar image
    Former Member
    Oct 18, 2006 at 02:12 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 18, 2006 at 02:41 PM

    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

    Add comment
    10|10000 characters needed characters exceeded