Dynamic Select of Row in a table in webdynpro Abap

Hi,
  I have an requirement, I have an table  and a button, I need to select a row in a table based on button action.
For example : in a table i have 3 rows. I am submiting a value in a button, I want to see that row highlighted for the value I am sending through button.
Please let us know the code how to implement this.
Thanks

Hi,
First you have to go to table and set its property "SELECTION MODE" to single or multi lead depending on ur need.
Then in the ACTION of the button you can use the following code to get the values in the selected row.
DATA:
     node to get table node for finding no. of rows
        lo_nd_one  TYPE REF TO if_wd_context_node,
     Get selected row for finding no. of rows
   it_table               TYPE        wdr_context_element_set,
     workarea to get selected row
        wa_table                LIKE LINE OF           it_table,
To get the Selected line item into an internal table
  CALL METHOD lo_nd_one->get_selected_elements
    RECEIVING
      set = it_table.    " data in internal format
  IF it_table[] IS NOT INITIAL.
  type conversion for work area
    READ TABLE it_table INTO wa_table INDEX 1.
if a row is present
    IF  sy-subrc IS INITIAL.
    Get the values of each attribute
      CALL METHOD wa_table->get_static_attributes
        IMPORTING
          static_attributes = wa_final.       "<Selected data in work area.>  ---> this will have your data
    ENDIF.
Here wa_final is the work area which is of your table fields type.
This wa_final will have the selected row.

Similar Messages

  • 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

  • Select all rows in af:table

    Hi,
    I need to select all rows in af:table, not only on current page.
    I have following code on custom select all action:
    getTable2().getSelectionState().addAll()and on button that needs to perform some action on selected rows I have this code
            Set selectedRowSet = getTable2().getSelectionState().getKeySet();
            if (!selectedRowSet.isEmpty()) {
                Iterator it = selectedRowSet.iterator();
                while(it.hasNext()) {
                    Key key = (Key)it.next();
           }selectedRowSet.iterator() method throws java.lang.ClassCastException: oracle.jbo.Key.
    When I select rows with af:tableSelectMany, which is inside selection facet and selects only rows on current page, this works fine.
    Any ideas?
    Thanks

    Hi,
    you can only access those data that is queried and part of the CollectionModel to the time you select all
       RichTable _table = employeesBackingBean.getEmployeeTable1();
       RowKeySet rks = new RowKeySetImpl();
      CollectionModel model = (CollectionModel)_table.getValue();
      int rowCount = model.getRowCount();
          for (int i = 0; i < rowCount; i++) {
               model.setRowIndex(i);
               //note that in the simple POJO case, the row key is the same
               //as the index. However, it would be wrong to just rely on this
               //because other models or custom table models my return a more
               //comples key. Therefore we iterate over the available rows to
               //obtain the keys.
               Object key = model.getRowKey();
               //add the row keys to the RowKeySet to mark selected
               rks.add(key);
       _table.setSelectedRowKeys(rks);
       AdfFacesContext.getCurrentInstance().addPartialTarget(_table);Frank
    Frank

  • Select a row from a table and throw an url

    Hi experts,
    I'm trying to select a row from a table in Visual Composer. What I need to do it's to click over this row and throw an Url. At the moment, I've added a column with a Pushbutton with the formula to show the link; it works fine. But I need to do it without buttons just selecting the row.
    Is there anyboby who knows about that?
    Thanks a lot.
    Belen

    Hi
    To do this you will have to use a data store and a guard condition on the line which is triggered by the select action. You need to store a value in the data store each time a select action is performed. The guard condition should check for this and only perform the action when the value in the data store is greater than 0.
    Jarrod Williams

  • Select multiple rows from dual table

    Is it possible to select multiple rows from dual table using a single select statement.
    i.e., i want the out put to be
    column_name
    1
    2
    3
    4
    Edited by: vidya.ramachandra on Dec 14, 2009 8:24 AM

    Aside from the fact you're responding to an old thread...
    1002424 wrote:
    While using CONNECT BY, I see it always leave behind one row.
    Suppose I have a condition based on which I have to generate constant rows like
    SELECT 1 FROM DUAL WHERE ROWNUM < N;
    Here if N = 0, still it gives out single row.... you are obviously doing something wrong in your code elsewhere, because that SQL statement does not always return a single row...
    SQL> SELECT 1 FROM DUAL WHERE ROWNUM < 0;
    no rows selected
    SQL>

  • Enable Buttons after selection of row in a table

    Hi All
    Could any one give me help in this. I have a table, in table tool bar some buttons are there. at first time buttons are in disable mode, when user select any row in the table the buttons should be in enable mode. how to do this? help me
    Thanks,
    kris.

    hi,
    for table you have lead select action. you can write the code in this ction method to enable and disable the buutons based on the lead selection.
    or you ca alsoput your code in modify view and check if the instance of element is bound then enable else disable,
    lo_element = lo_node->get_element(). Lo_element will be bound only if there is a lead selection in the table.
    if lo_element is bound.
    enable the buttons.
    else.
    disable the buttons.
    endif.
    Regards,
    Madhu

  • Easy Question:Select many rows from a table and execute BAPI for these rows

    Hi Experts,
    I have created one WD project. The WD project fetches some records of backend using BAPI and displays in a table. I have to select some rows from the table and then execute BAPI for selected rows.
    How I can select multiple records from the table and then execute another BAPI for selected rows.
    Regards,
    Gary

    Hi,
    In the Node which you binded to the table create one more attribute of type boolean.
    For example your node is as below:
    //Table Node
    TableNode
    > Att1
    > Att2
    > isSelected(boolean) - Newly created attribute for this requirement.
    //Result Node contains the elements selected in TableNode
    ResultNode
    >Att1
    >Att2
    Now in the table create one more Column with Checkbox as tablecell editor. Now bind this boolean attribute to that check box.
    Now in the code you can get the selected rows by user as below:
    for(int i=0;i<TableNode().size();i++)
      if(wdContext.nodeTableNode().getTableNodeElementAt(i).getIsSelected()==true)
        IPrivateTestView.IResultNode element=wdContext.createResultNodeElement();
        element.setAtt1(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt1());
        element.setAtt2(wdContext.nodeTableNode().getTableNodeElementAt(i).getAtt2());
       wdContext.nodeResultNode().addElement(element);
    Regards,
    Charan

  • Selecting multiple rows of a table

    Hi Forum,
    How to select multiple rows of a table at a time? Please help me..
    Thanks
    Swapna

    Hi Swapna,
    To select more then one row in table, just set the selectionmode property of table to 'multi' or 'auto' and also change the selection property of the node (to which table is binded) to  0:n.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun on Feb 4, 2009 11:52 AM

  • Select discontiguous rows in a table with the keyboard

    I am using jdk 1.3.1 and have tried this on 1.4 as well. I don't seem to be able to select discontiguous rows in a table using the keyboard. I can Ctrl-click with the mouse to do this but can't find a way to do this with the keyboard. I searched and found somebody asked this same question before and the reply was it works in 1.3.1. I am not seeing this. What could I be missing? The Ctrl-Up and Ctrl-Down keys don't do anything and neither does the spacebar.

    I'm pretty sure you can't do this using the standard JTable interface.
    You might be able to write your own keyboard listener and fake focus events for up&down arrow, but making this work seamlessly with JTable seemss like it would not be trivial.

  • Unable to select any row(s) in table/ALV

    Hi ,
    I am having a problem while selecting a row in a table/ALV.
    I am displaying data in a table which is NOT set to 'Initialize lead selection' in the context.When it is displayed and I try to select a row the row does not get selected(highlighted) in the view.
    However,I am able to perform tasks on 'Onselect' event on the rows.Just that its not getting highlighted neither in table nor in ALV.
    What could be the reason for this ? I do not want the context element to be set as 'Initialize lead selection' as that would highlight the first line of the table when the view is rendered first time.
    Thanks for your help,
    Sandip.

    hi sandip,
    Try this method
    lo_table_sett  TYPE REF TO if_salv_wd_table_settings.
    lo_config_tab TYPE REF TO cl_salv_wd_config_table.
    lo_config_tab = lo_ref_interface_controller->get_model( ).
    lo_table_sett   ?= lo_config_tab.
    lo_table_sett ->SET_SELECTION_MODE( value ).
    value- '00' for auto
             '02' for single
             '04' for multi
             '06' for none
             '07'  for singleNolead
             '08' for multi Nolead
    Regards,
    janakiram

  • Make entries in a table in webdynpro abap

    Hi all,
    We have a requirement to make multiple entries in a Table in webdynpro ABAP.
    We have created a table and inserted inputfield as cellEditor
    but at runtime it is being displayed in readonly mode we cannot enter anything in that inputfield.
    inputfield is binded with a context and table is not in readonly mode.
    Please help in this regards
    thanks & regards.....
    Gaurav Makin

    Hi Gaurav,
    Make sure the context node bound to the table has cardinality 0..N.
    When the app starts you probably need to read the table contents from the database or some other source and populate the contect node.
    The table will allow the user to edit values only for the rows that have a corresponding element in the context node.
    If the initial content is empty, i.e. no elements in the context node then the user will not be able to edit.
    You will need to either initialize the context node with a bunch of elements if the number of entries is fixed and known beforehand,  or provide a way for the user to create a new row.
    You can do this by adding a toolbar to the table with a create button with a CREATE action and the following method:
    method onactioncreate.
      data:
        lo_element type ref to if_wd_context_element,
        lo_node    type ref to if_wd_context_node.
      lo_node = wd_context->get_child_node( name = 'your node name here' ).
      lo_element = lo_node->create_element( ).
      lo_node->bind_element( new_item = lo_element set_initial_elements = abap_false ).
    endmethod.
    Regards... Lucio Menzel

  • How to refresh interal table in Webdynpro ABAP

    Hi all,
    I want to delete/free/refresh interal table in webdynpro abap.
    One of the form gave solution to pass blank internal table?
    I cleared node and itab in webdynpro, but internally SAP doesn't delete the context node and itab values.
    Please help me in how to refresh itab in webdynpro abap.
    Regards,
    Prasad

    Hi Srinivas,
    it doesn't work.
    I wrote like this in action list method.
    method lta_task.
    if not lcontext_node_task is intial.
    context_node_task->invalidate().
    endif.
    select.......
    populate data into internal table lt_task_output_table .
    if not lt_task_output_table  is inital.
        context_node_task = wd_context->get_child_node( name = 'TASK_PER').
        context_node_task->bind_table( wd_this->lt_task_output_table ).
    endif.
    endmethod.
    Starting of the mehod i have written to inavlidate, before upating the itab
    but donesn;t work. Where should I write the code
    Reagards,
    Prasad

  • How can I change column name in ALV table in WebDynpro ABAP?

    Hi Everyone,
    I have created an ALV table in WebDynpro ABAP. I have created a context node and added the required attributes there - for the ALV display.
    Now I want to change one columnn name of the ALV table.... Currently it is showing the description of the data element, which I don't want to show. I cannot create a new DE only for this purpose.
    Please let me know how can I change the name of the column.
    Regards

    Hi,
    This may help you to define your own column text in the ALV Table of webdynpro.
    see the below code.
    Here 'STATUS_ICON' is the column of the the output display of the ALV Table of webdynpro.
    "change the label of the report.
    DATA: lr_weeknum TYPE REF TO cl_salv_wd_column.
    CALL METHOD l_value->if_salv_wd_column_settings~get_column
    EXPORTING
    id = 'STATUS_ICON'
    RECEIVING
    value = lr_weeknum.
    SET THE LABEL OF THE COLUMN
    DATA: hr_weeknum TYPE REF TO cl_salv_wd_column_header.
    CALL METHOD lr_weeknum->get_header
    RECEIVING
    value = hr_weeknum.
    CALL METHOD lr_weeknum->set_resizable
    EXPORTING
    value = abap_false.
    hr_weeknum->set_prop_ddic_binding_field(
    property = if_salv_wd_c_ddic_binding=>bind_prop_text
    value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
    set the text of the column
    CALL METHOD hr_weeknum->set_text
    EXPORTING
    value = 'C Form'.
    regarads,
    balu

  • Dynamically select multiple rows in web dynpro table

    Hi All,
    I am populating rows in a table by calling BAPI.
    I set the selection property to 1..n for the context model node in view and custom controller.
    I set the selectionmode property to multi for the table.
    I have a "Select All" button in my view.
    When i click this button, i want to select all the records in the table.
    Then i want to loop thru the selected rows.
    How can i do this?
    Please give me some sample code or reference documents.
    Thanks.

    Hi Tiruna,
    To select all elements in the node you can use following code (created by Valery Silaev) where select parameters indicate to "select" or "unselect":
         public static void selectElements(final IWDNode node, final boolean select)
              final int leadSelection;
              if ( select )
                   leadSelection = Math.min
                        Math.max( 0, node.getLeadSelection() ), node.size() - 1
              else
                   leadSelection = IWDNode.NO_SELECTION;
              for (int i = node.size() - 1; i >= 0; i--)
                   node.setSelected( i, select );
              if ( 0 < node.size())
                   node.setLeadSelection( leadSelection );
    to iterate selected elements you can use:
    for (int j = 0, n = wdContext.nodeRows().size(); j < n; ++j)
      if (wdContext.nodeRows().getLeadSelection() == j
        || wdContext.nodeRows().isMultiSelected(j)
        /* row at index j is selected */
    Best regards, Maksim Rashchynski.

  • Select second row of a table

    i have this query to count people who are in different deployment
    SELECT Trade.Trade, Trade.Auth,
    (select count(tradeno) from Member where trade=Trade.Trade) AS Held,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='Present') AS Present,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='KL') AS KL,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='HL') AS HL,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='SL') AS SL,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='TTT') AS TTT,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='COURSE') AS COURSE,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='UD') AS UD,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='LAW') AS LAW,
    (select count(tradeno) from Member where trade=Trade.Trade and Status='MAL') AS MAL
    FROM Trade ORDER BY id"
    the above query works for me fine. now there is a table named PL with field PL
    PL
    KM
    KT
    KM
    HG
    TG
    HG
    i want to make six different queries for each PL. add a clause in above query
    1. to select top 1 PL and also add where clause in the above query so that people employed in KM only gets counted and displayed
    2.  to select second row of  PL and also add where clause in the above query so that people employed in KT only
    gets counted and displayed
    as also for all other PL. please lelp me
    I am a System Administrator at Vadodara

    Sir
    The first query which i had given is correct and it works for me. Now i want to add one more
    clause that PL.PL and that PL should be dynamically selected and not manually added in query. The logic should be like this
    Above query + where PL.PL= second row of table PL that is the result required for me
    First problem is : I was not able to add the clause WHERE PL.PL=' '
    Second Problem is : If i had solved my first one the PL.PL must be automatically selected as
    i had given a sample query to select the second row from table PL.
    Then it is solved
    I am a System Administrator at Vadodara

Maybe you are looking for

  • I am trying to install Elements, I get this constant error message. This installation is not supported by this processor type. Contact your product vendor.

    I am trying to install Elements, I get this constant error message. This installation is not supported by this processor type. Contact your product vendor. I am using Windows 8.

  • OSB 11g Variable Creation

    Hi, The title is rather self-descriptive, but I'll elaborate a bit anyway. I'm receiving data from a local proxy service in and performing validation on it. After validation,the data has to be transformed into two target formats, i.e. the validating

  • SBLW-XPWEB-W3-US how can i get

    I recently exchanged my computer and removed all the upgrades i had on the older one and installed it on this one. i installed my li've 5. sound and game port card but i can't use it. windows does recognized it but when i install the file you so loid

  • Mainstage Cocoa View Problem

    Hello, I am just exploring mainstage and having the following problem: When you load a third party plug-in, normaly a cocoa view opens where you can control the plug-in. This works fine for all my plug-ins, except for Omnisphere. When I open Omnisphe

  • Adobe interactive forums

    Hi , <b>I am trying to create a sample adobe form with Using with SP 16. 1)design the form with one static text field, one input text field 2)created a value node and a value attribute to bind the values to datasource and pdfSource fields. 3)mode of