Multiple row selection for table element

Hi,
I have a requirement where I require to select multiple rows from a table element in a WD for abap application.
I have defined a node with cardinality and selection set to 1..n.
The contex node contains 4 fields : emp_name, pernr, manager and position.
The attributes of the table element for selectionmode is set to 'multi' and 'selectionchangebehaviour' is set to 'auto'.
I have defined an action on the 'onleadselection' event.
The code in this method also includes the statement 'lo_el_team_view->set_selected( EXPORTING flag = abap_true ).' 
When I execute the application only 1 row is highlighted at any one time when I select it. You can select multiple rows by holding down the 'ctrl' key but I want to avoid having to do this. Is there anything I have missed out causing multiple row selections not to be all highlighted.
Thanks in advance for any assistance.

Hi raj,
you can try the following code in the 'onleadselect' event of the table,
create one attribute ' Flag'  of type WDY_BOOLEAN under the node which has been binded to the table.
DATA lo_nd_node_tab1 TYPE REF TO if_wd_context_node.
  DATA lo_el_node_tab1 TYPE REF TO if_wd_context_element.
  DATA  lo_elements TYPE wdr_context_element_set.
  DATA  lo_ele_select_new TYPE REF TO if_wd_context_element.
  DATA lv_deselect TYPE wdy_boolean.
  DATA lv_flag TYPE wdy_boolean.
  DATA lv_select TYPE wdy_boolean.
  DATA lv_index TYPE i VALUE 0.
  lo_nd_node_tab1 = wd_context->get_child_node( name = wd_this->wdctx_node_tab1 ).
get the current selected element
  lo_ele_select_new = wdevent->get_context_element( name = 'NEW_ROW_ELEMENT' ).
  CHECK lo_ele_select_new IS NOT INITIAL.
check whether it has been selected or not
  CALL METHOD lo_ele_select_new->is_selected
    RECEIVING
      flag = lv_select.
  lo_ele_select_new->get_attribute( EXPORTING name = 'FLAG' IMPORTING value = lv_deselect ).
check whether element has been previously selected or not,if not, set the flag to select it
IF lv_select IS NOT INITIAL AND lv_deselect IS INITIAL.
    lo_ele_select_new->set_attribute( name = 'FLAG' value = 'X' ).
if selected currently and previously then set the flag as false,in order to delect it
  ELSEIF lv_select IS NOT INITIAL AND lv_deselect IS NOT INITIAL..
    lo_ele_select_new->set_attribute( name = 'FLAG' value = ' ' ).
  ENDIF.
  CALL METHOD lo_nd_node_tab1->get_elements
    RECEIVING
      set = lo_elements.
according to the falg, select and delect the elements
LOOP AT lo_elements INTO lo_el_node_tab1.
    lo_el_node_tab1->get_attribute( EXPORTING name = 'FLAG' IMPORTING value = lv_flag ).
    IF lv_flag = 'X'.
      lo_el_node_tab1->set_selected( abap_true ).
      lo_nd_node_tab1->set_lead_selection_index( lv_index ).  * this statement deselects the lead selection index*
    ELSE.
      lo_el_node_tab1->set_selected( abap_false ).
      lo_nd_node_tab1->set_lead_selection_index( lv_index ).
    ENDIF.
  ENDLOOP.
I hope this resolves your problem.
Thanks,
krishna

Similar Messages

  • Multiple row select for table not working..

    Hi Experts,
    I have a table in ABAP Web Dynpro where I have enabled the multiple row select functionality. I can select all and deselect all. I can also select a block of adjacent rows of table by choosing first and last by pressing Shift key.
    But I am not able to select multiple individual records for that table.
    I tried the same thing in different system and it works fine there.
    Please let me know if we are missing some standard plugin or we need to enable this in some settings.
    System where the issue is:
    SAP_APPL: release 600, level 18
    SAP_BASIS: Release 700, level 22
    System where it is working fine:
    SAP_APPL: release 604, level 8
    SAP_BASIS: release 701, level 8
    Regards,
    Anand Kolte

    Hi
    Press CTRL key and Select records, you can select multiple records, continuously or randomly your desired selection.
    Cheers,
    Kris.

  • ABAP WD, Multiple Row selection in table control

    Hi all,
            I am populating and displaying the records using the table control, i have to select the multiple records in the list and want do some deletion,selection,so i could not select the more than one record.
    How do i solve this?
    Please give me your valuable suggestions.
    Thanks

    Hi ulli,
    thanks for your quick reply,
    now its working for me but i have to press the 'CTRL' key and select the row, for selecting the multiple rows.
    one more thing i wanted some methods for "DELETION", "SELECTING ALL RECORDS","DESELECTING",in the displayed list.
    plz suggest me..,
    thanks and regards
    kamal

  • Multiple row selection in Table

    Hi Experts,
    I have created one popup with a table inside that.
    My question is how can i add multiple rows, enter value in those rows and on clicking the
    copy button all the value in the rows will be copied into the main view.
    All the rows should be editable.

    Hi Armin,
    Thanks a lot for the reply.
    In my application when i am selecting the multiple rows which i entered earlier in the popup window, it's getting populated into main window.
    But in main window only one input field is there,so only the fiest record is getting displyed after selection.
    Rest of the records i am not able to display in the main window.And the problem is i can't add more than one input field in main window. Rest of the values will be passed into R3 through coding but it can't be displayed on screen.
    So please advice me on these two scenarios.
    1 . How to populate multiple row values(input fields in popup window with value enterd by user) into 
         main view. In main view only one input field is there.
    2 .  How to pass all the selected values from main window to R3 by webdynpro coding.
          All the values coming from popup need to be passed even though  only one value is displayed.
    Here the input field in main window is mapped to one model attrribute.
    Thanks a lot.

  • Multiple row selection in table control...

    hi...
    i can select one row from table control and display in a list..
    the same thing i want to do for multiple lines...
    thanks..

    use the table control wizard to create a table control on the screen...while going thru the steps, there will be a screen which asks you about the selection column (this is a single character field in your internal table). on this step there is a selection option for single/multiple selection of rows....
    to access the selected records, use...
    loop at itab where sel eq 'X'.
    endloop.
    where
    <b>itab</b> is the underlying internal table for table control and <b>sel</b> is the name of the selection column
    or if u already have a table control on screen...double click and open the properties window...there u can see radio buttons None, Single and Multiple for line selection. choose the multiple option.
    rgds,
    PJ
    Message was edited by: Priyank Jain

  • Multiple row selection in table contrl with wizard

    Hi all,
    i developed a table control using wizard . i have the plus and sub buttons that came when i udes wizard to delete or adda row.
    My question is : It allows me to delete one row ata time is there way where i can delete mutliple rows in a single attemp  i.e i wiuld select multiple rows at one and click the delete row and it need to delete all selected rows , now it allows me to select only one row at atime
    Thanks all in advance
    Suchitra

    HI,
      Set the Mulbiple row selet propery at the table control level to get this working.
    Thanks
    mahesh

  • ABAP WD, Multiple Row selection in table control without using Crtl key

    Hi all,
    I am displaying the records using the table control, i have to select the multiple records in the list <b>without using Crtl key</b>.
    How do i solve this?
    Thanks

    Hi,
    you should set the table parameter selectionMode to multi or multinolead
    than you can select multiple records,
    these you can retrieve: lt_selected_elements = node->get_selected_elements( ).
    also see this <a href="https://forums.sdn.sap.com/click.jspa?searchID=4209200&messageID=3544158">thread</a> for info
    grtz,
    Koen

  • Retrieving multiple rows selected from a table

    I want to retrieve selected multiple rows from a table and pass it to other views. Does anyone know how to implement this

    You could try a simple example:
    Create a context node "Rows" with a string attribute "Text". Create some node elements in wdDoInit().
    Create an action "ShowSelectedRowIndices" and implement the event handler as follows:
      //@@begin javadoc:onActionShowSelectedRowIndices(ServerEvent)
      /** Declared validating event handler. */
      //@@end
      public void onActionShowSelectedRowIndices(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionShowSelectedRowIndices(ServerEvent)
        StringBuffer msg = new StringBuffer("Multi-selected rows:");
        for (int i = 0; i < wdContext.nodeRows().size(); ++i)
          if (wdContext.nodeRows().isMultiSelected(i))
            msg.append(" ").append(i);
        wdComponentAPI.getMessageManager().reportSuccess(msg.toString());
        //@@end
    When executing the action (e.g. with a button) you will see the selected indices in the message area.
    Regards, Armin

  • Reg Selection of  Multiple Rows in a Table

    Hi all,
    I have to select multiple rows from a table and have to display those selected records in another table in the next screen.
    The problem is, when I am selecting the records in a table, selection should not be allowed on some records based on a condition. Is it possible with the default selection mode of webdynpro. If so, Please tell me how can we disable the selection of certain records in a table(using the default selection mode provided by webdynpro)
    Else, if we have to use check boxes for selection(in case of my problem), please do help me out in how to disable the selection of certain records in a table(using check boxes for selection).
    Please help me out. Its urgent...
    Reward points guranteed.
    Regards,
    Murthy.

    HI Narayana,
    Multiple selection  property is specific to a table, not for a tableElment(ie. for a row), so u cant set some of the rows as multi selected and some as node
    U can use Checkbox for this purpose. Based on the condition u can make the check box as enabled and disabled
    To achieve this, Create 2 boolean variables inside table node, one for checkbox value(Let it be <b>CBValue</b> .Bind this to checked property of Checkbox) and other for enabling and disabling Checkbox(Let it be <b>CBReadOnly</b>. Bind this to readonly property of CheckBox).
    At the time of creation of table elements, as per the condition, u can control the selection as
    IPrivate<View>.I<Table>Node tNode=wdContext.node<Table>();
    for(int i=0;i<5;i++)
    IPrivate<View>.I<Table>Element tEl=tNode.create<Table>Element();
    tNode.addElement(tEl);
    tEl.setCBValue(false);//Unchecking Checkboxes initially
    if(condition=non selectable)
      tEl.setCBReadOnly(true);
    else
      tEl.setCBReadOnly(false)
    Regards
    Fahad Hamsa

  • Selecting multiple rows in a table

    Hi All,
    I have one problem with selecting multiple rows in a table.I tried with setting table property-selectionMode as Multi, but i dinn't get the solution.
    please provide me solution for this.
    Thanks & Regards,
    Sreelakshmi.

    HI
    Int leadSelection = wdcontext.nodemodelnode.getLeadSelection();
      for(int i=0;i<wdcontext.nodeModelNode.size;i++)
        if(wdcontext.nodeModelNode.isMultiselected(i) || leadSelection ==i)
               String name = wdcontext.nodemodelnode.getnameelementatindex(i).getName();
               String  address = wdcontext.nodemodelnode.getaddresselementatindex(i).getAddress();
               String age = wdcontext.nodemodelnode.getAgeelementatindex(i).getAge();
            Create a method for the Table Property onLeadSelect() where you can open a popup window
             Create a value node and with attributes same as Table attributes and then set the values of the table
             to the value node attributes.
    Thanks

  • JDev 11g-Multiple Row Selection Table-Ctrl+A error

    Hello All,
    Jdeveloper : Studio Edition Version 11.1.1.2.0, Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    ADF Business Components : 11.1.1.55.36
    Java(TM) Platform : 1.6.0_11
    Oracle IDE: 11.1.1.2.36.55.36
    SOA Composite Editor: 11.1.1.2.0.12.16
    Versioning Support: 11.1.1.2.36.55.36
    I am trying to remove the selected rows from the table with RowSelection property set to Multiple. I am able to select the rows using by holding key board Ctrl key and click on the rows. The following code in backing bean successfully deletes the rows selected using this step.
    public void removeGeoSpecs(ActionEvent actionEvent)
    RowKeySet rowKeySet = getGmemTbl().getSelectedRowKeys();
    CollectionModel collectionModel =
    (CollectionModel) getGmemTbl().getValue();
    for (Object facesTreeRowKey: rowKeySet)
    collectionModel.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding) collectionModel.getRowData();
    rowData.getRow().remove();
    But when i select all the rows in the table using Ctrl+A, all the rows got selected. I hit the Remove button, then after deleting the first row, getting the following error.
    javax.servlet.ServletException: ADFv: Could not find row: USA 548 with key: oracle.jbo.Key[] inside parent: GeoSpecTVOIterator with key: null.
    Caused by: java.lang.IllegalStateException: ADFv: Could not find row: USA 548 with key: oracle.jbo.Key[] inside parent: GeoSpecTVOIterator with key: null.
    Here USA 548 is my first row's data. Please let me know if you want complete error stack.
    During design time, While drag and drop the table i have not selected Row Selection check box as it sets property for single row selection. Table is inside the <af:panelCollection> . Here is the table source.
    <af:table value="#{bindings.GeoSpecTVO.collectionModel}" var="row"
    rows="#{bindings.GeoSpecTVO.rangeSize}"
    emptyText="#{bindings.GeoSpecTVO.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.GeoSpecTVO.rangeSize}"
    rowBandingInterval="0" id="GmemTbl"
    partialTriggers=":::AddRowsBtn :::AddRangeBtn ::RemoveBtn :::SaveBtn"
    rowSelection="multiple"
    binding="#{backingBeanScope.GeoGrpSpecBean.gmemTbl}">
    Here GeoSpecTVO is a transient view object which is not having query and not attached with EO.
    I tried to fix this issue by myself and also searched for similar issues in the FORUM and google. But no luck... I very much appreciate all your inputs/pointers. Kindly let me know if you need additional information.
    Thanks
    Annadurai.

    Hi Annadurai
    I tried the same work around but still i am facing the issue, could you please help me.
    public void deleteRec(ActionEvent actionEvent) {
    // Add event code here...
    RowKeySet rowKeySet = (RowKeySet)this.embossTB.getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)this.embossTB.getValue();
    Row specRow = null;
    ArrayList rowList = new ArrayList();
    int listLength = 0;
    ArrayList<Number> printReqLST=new ArrayList<Number>();
    ViewObject vo1=null;
    boolean flag=false;
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();
    specRow = rowData.getRow();
    rowList.add(specRow);
    listLength++;
    for (int index = 0; index < listLength; index++){
    specRow = (Row)rowList.get(index);
    Number printReqID = (Number)specRow.getAttribute("PrintRequestId");
    String PrintState = specRow.getAttribute("PrintState").toString();
    if (PrintState.equalsIgnoreCase("PRINTED")) {
    System.out.println("cann't delete");
    FacesContext fctx = FacesContext.getCurrentInstance();
    FacesMessage message =
    new FacesMessage("Cann't Delete the selected row:" + printReqID);
    message.setSeverity(FacesMessage.SEVERITY_ERROR);
    fctx.addMessage(null, message);
    } else {
    System.out.println("delete");
    flag=true;
    specRow.remove();
    if(flag){
    System.out.println("before commit");
    commitRows();
    }

  • Multiple row selection in ADF Table using addition column with checkbox

    I am using ADF table(Jdeveloper11g) and i want to selecte multiple rows it may be more than one OR all rows.
    For that i added one Column to the table with Header Delete and checkbox
    <af:table....
    <af:column sortProperty="Delete" headerText="Delete" width="100"
    sortable="false">
    <af:selectBooleanCheckbox label="#{row.favoriteId}"
    valueChangeListener="#{Mybean.onCheck}"
    id="checkbox" autoSubmit="true">
    </af:selectBooleanCheckbox>
    </af:column>
    </af:table>
    backing bean:Here i added code to get Value of one column with id favoriteId and use an arrayList(listForDelete) to monitor the state of the checkboxes
    public void onCheck(ValueChangeEvent valueChangeEvent) {
    BindingContainer bindings = getBindings();
    DCBindingContainer dcBindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding iterBind =
    (DCIteratorBinding)bindings.get("getUserFavoritesByUserIDIterator");
    if (iterBind != null && iterBind.getCurrentRow() != null) {
    RichSelectBooleanCheckbox ch = (RichSelectBooleanCheckbox)valueChangeEvent.getSource();
    if (!ch.isSelected()) {
    Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
    listForDelete.add(issueId);
    else
    Long issueId = (Long)iterBind.getCurrentRow().getAttribute("favoriteId");
    listForDelete.remove(issueId);
    Problem is that when i select single row checkBox, onCheck() method of backing bean gets called multiple times(equals to the number of rows)
    I think this is beacuse of <af:selectBooleanCheckbox id is same that is "checkbox" but i am not sure.Even i tried to assign some unique id but no any success in assigning Id with value Expression.
    I also find related post
    Re: ADF Table Multiple row selection by Managed Bean
    but that is related to Select All rows or Deselect all rows from table.
    From the simillar post i follow the steps given by Frank.but problem with below step
    ->have an af:clientAttribute assigned to the checkbox with the following EL #{row.key} ,here I added <af:clientAttribute name="#{row.key}"></af:clientAttribute> and i am getting error
    Error(64,37):  Static attribute must be a String literal, its illegal to specify an expression.
    Please let me know if any one had already implemented same test case.
    Thanks for all help
    Jaydeep
    Edited by: JaydeepJ on Aug 7, 2009 4:42 AM

    just to update after the rollback is called in the cancel button i wrote following code which does not change the row focus to the first row
    DCBindingContainer bc =
    (DCBindingContainer)BindingUtils.getBindingContext().getCurrentBindingsEntry();
    DCIteratorBinding profItr =
    bc.findIteratorBinding("ProfileSearchInstIterator");
    Row cRow = profItr.getRowAtRangeIndex(0);
    if(cRow != null){
    System.out.println("Current row is not null so fixed ");
    profItr.setCurrentRowIndexInRange(0);
    RowKeySetImpl rks = new RowKeySetImpl();
    ArrayList keyList = new ArrayList();
    keyList.add(cRow.getKey());
    rks.add(keyList);
    profileTable.setSelectedRowKeys(rks);
    AdfFacesContext.getCurrentInstance().addPartialTarget(profileTable);
    }

  • Multiple row selection capability in the table

    Hi
    I have a group with table layout style and I want to set the rowSelection property of the generated table to "multiple" but it seems that there is no way to do that from JHs unless using the group as LOV, which is not desired for me. Here is the code which sets this property in tableGroup.vm :
    #if (! ($JHS.current.group.useAsLov && $JHS.current.group.multiSelect))
    selectionListener="#{#BINDINGS_TABLE().collectionModel.makeCurrent}"
    rowSelection="single"
    #if( ! $JHS.current.group.useAsLov )
    selectedRowKeys="#{#TABLE_BEAN().selectedRow}"
    #end
    #else
    rowSelection="multiple"
    selectedRowKeys="#{#LOV_PAGE_BEAN().selectedRowKeySet}"
    selectionListener="#{#LOV_PAGE_BEAN().selectionListener}"
    #end
    Is there any reason to not allowing to have multiple row selection capability in the table when it is not in LOV mode?
    Thanks
    Ferez

    Ferez,
    No, but if you want to have multiple selection, there is typical a custom action you want to apply to the selected rows, which cannot be defined in the Jheadstart Application Definition editor.
    However, it is perfectly fine to use a custom tableGroup.vm template and enable multi-selection.
    Steven Davelaar,
    JHeadstart team.

  • Multiple Rows Selection In Advance Table

    Hi All,
    I have a requirement to select multiple rows in advance table.After selection these rows they get added to the record list of another page on click of seeded submit button.This is my custom region.And this functionality is working for seeded region.
    I have added multiple selection component in advance table component.
    How should I make this functionality work for my custom region using the seeded submit button.
    Regards,SHD

    Hi,
    After selection these rows they get added to the record list of another page on click of seeded submit buttonon the click of submit button save the data to the table from where u are getting the data for the other page....Once this data get saved to the table, will definitely shows up in next page.
    Regards,
    Gyan

  • Best practice for deleting multiple rows from a table , using creator

    Hi
    Thank you for reading my post.
    what is best practive for deleting multiple rows from a table using rowSet ?
    for example how i can execute something like
    delete from table1 where field1= ? and field2 =?
    Thank you

    Hi,
    Please go through the AppModel application which is available at: http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    The OnePage Table Based example shows exactly how to use deleting multiple rows from a datatable...
    Hope this helps.
    Thanks,
    RK.

Maybe you are looking for

  • Why is FF takes so much time to open web sites?

    I am going to compare FF with Google Chrome. So, I have a site that I would like to open: [http://wwwtruconnect.com truconnect.com] It only takes 3 seconds for Google Chrome to open that web site. When it comes to FF, it takes good 6 seconds, which i

  • How to disable an ipod touch that won't connect to itunes or the computer

    I recently got an ipod touch that was reset before being given to me. It wouldn't connect to iTunes or the computer but would still charge in the USB port. I updated iTunes and tried doing a soft reset holding down home and sleep. Then I realized on

  • So my grandmother purchased me a useless $100 iTunes gift card....

    She lives in Canada, but I live in the US. Guess what.. apparently my 86 year old grandmother just got taken for a ride by Apple. She has no computer, no cell phone, just a kindly little old lady who knows her grandson likes music/games and has some

  • Error in RFC: Name of password is incorrect

    Hi All, I am using GRC AC 10.1 with SP06 and came across with one issue and so need your help to rectify it. I have created one cross system groups for all deveopement clients (SAP_DEV_CG) and put all the D-clients for all the landscapes. While runni

  • Oracle forms upload crash

    Hi, I downloaded the VM "Database App Development VM" from http://www.oracle.com/technetwork/community/developer-vm/index.html and executed, on this installation, upgrade to APEX 4.2.4.00 .08 through patches. My problem is that converting an oracle f