Know the number of the row in a select

Hi experts,
I´m doing a select * ... such as:
*      SELECT *
*        FROM YPLM00 CLIENT SPECIFIED
*        WHERE mandt = sy-mandt
*        AND TIPOL = 'RS'
*        AND PSPNR = yplm00_tree-pspnr
*        AND TIPOP = yplm00_tree-tipop
*        AND PROCE = yplm00_tree-proce
*        AND ID_ED = yplm00_tree-id_ed
*        AND TIPOE = yplm00_tree-tipoe
*        AND ID_EN = yplm00_tree-id_en.
Can i know the number of the row that is affected? I don´t want the total of rows... i want the number of each one...
Thanks in advance,
regards

>
Victor Capi wrote:
> I have a table with
>
> Q   W   E   R
> E   T    U    I
> A   Q    E    T
> A   W   R    F
Hi Victor,
I see what you mean.  The problem is still that there isn't actually a row number associated with each database row.  In your example, what is the primary key of the table?  If it is say A Q E for row 3 and A W R for row 4 then that is the only way you can identify them.
It sounds like you have performance considerations so probably change the SELECT * to only SELECT the fields you need.  Also change it so that you are SELECTing into a table - so in your example you would get both rows 3 and 4.  Then if you want to process those rows, you will have to use their primary keys to identify them, say by LOOPing through the internal table you have just selected them into.
Do you already have an internal table with values you wish to read from this table?  So say you have a table with 500 entries which all define the value in the first column of this table?  If so you could try chaning to using a FOR ALL ENTRIES in your select to get all rows for the table in one hit - you can then process them again in a LOOP.
Hope this helps in some way.
Gareth.

Similar Messages

  • Count the rows which are selected ?

    Hi Experts,
    I need help.My requirement is:
    I am having a table which can be multiple selected. But there are two buttons attached to it.Edit and Delete.For Delete I want the Multiple Selection not for EDit.So, If i will click the Edit after multiple selection of the rows.How i can give pop-up that multiple edit is not possible?Means I want to count the rows which are selected how to do that?
    Please guide me.
    Urgent need
    Regards
    Nutan

    Hi Nutan,
    Marcel is right about backend. However I might have an idea once I am developing a quiet similar solution. I would like to ask you to explain with more detail. It seems you have two requirements in one question.
    Regards,
    Gilson

  • Random selection of rows from a 2D array then subset both the rows that were selected and those that were not. Please see message below.

    For example, I have a 2D array with 46 rows and 400 columns. I would like to randomly select 46 data rows from the 2D array. By doing the random selection it means that not all individual 46 rows will be selected some rows may appear more than once as there may be some duplicates or triplicates in the random selection. The importan thing is that we will have randomly selected 46 rows of data (no matter that some rows appear more than once). Then I would like to subset these randomly selected 46 data rows (some which will be duplicated, or triplicated, etc.) and then also find and subset the rows that were not selected. Does this make sense? Then i would like to do this say 10 times for this data set. So that then I will have 2 by 10 data sets: the first 10 each with 46 rows and the other 10 with n rows depending on how many WERE NOT randomly selected. i hope that my explanation is clear. I am relatively new to Labview. It is really great so I am getting better! If anyone can help me with this problems it will be great. RVR

    Start by generating randon #s between 0 and 45. Run a for loop X times and in it use the random function, multiply the result by X and round down (-infinity). You can make this into a subVI, which you can reuse later. In the same loop, or in a different one, use Index Array to extract the rows which were selected (wiring the result out of the loop with auto indexing causes it to be rebuilt into a 2D array).
    One possible solution for the second part would be to go over the array of randomly generated numbers in a for loop and use Search 1D Array to find each of the numbers (i). If you get -1, it means the row wasn't selected and you can extract it.
    I hope this puts you on the right path. If not, don't be afraid to ask more.
    To learn more about LV, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide.
    Try to take over the world!

  • How to know Number of the Row which is selected in Advanced table

    Hi All
    I have a requirement where in an advanced table, when user clicks on copy icon against a row..a new row is created with copied values of the row against which copy action is performed.My issue is: assume in table i have got 5 rows..when user clicks on copy..my copied row gets created in the end..but i want tht row to be created directly under the row against which copy action is performed.I think somehow if i am able to know the position number of the row against which copy action is performed..i should be able to achieve it...can you please help me on this.
    Thanks
    Raj

    hi raj,
    create a fire action to the copy image.
    and then copy this method in to u r AM,
    public void copy action(String s)
    PwrPosViewShipmentsVOImpl sVO = getPwrPosViewShipmentsVO();
    RowSetIterator rowsetiterator;
    OADBTransaction oadbtransaction;
         rowsetiterator = sVO.findRowSetIterator("ships");
    int i;
         int j;
    if(rowsetiterator == null)
    rowsetiterator = sVO.createRowSetIterator("ships");
    oadbtransaction = getOADBTransaction();
    rowsetiterator.reset();
    i = 0;
    if(!sVO.isPreparedForExecution())
    rowsetiterator.setRowValidation(false);
    String s1;
    PwrPosViewShipmentsVORowImpl sVORowImpl1;
    PwrPosViewShipmentsVORowImpl sVORowImpl=null;
    do
    if(!rowsetiterator.hasNext() || i >= sVO.getFetchedRowCount())
    break;
    i++;
    sVORowImpl = (PwrPosViewShipmentsVORowImpl)rowsetiterator.next();
    s1 = copyServerUtil.replaceNull(sVORowImpl.getAttribute("view attribute of the referenced column"));
    } while(!s.equals(s1));
    j = sVO.getRangeIndexOf(sVORowImpl);
    sVORowImpl1 = (PwrPosViewShipmentsVORowImpl)rowsetiterator.createRow();
    sVO.insertRowAtRangeIndex(j + 1, sVORowImpl1);
    rowsetiterator.closeRowSetIterator();
    * create a new class file under the server folder and paste the below into that. and then import that class file into u r AM. and then try to run as a whole. u will get ur required work.
         public static final String replaceNull(Object obj)
    if(obj == null || obj.equals("null"))
    return "";
    } else
    return obj.toString();
    }

  • How can i know the row number of my table is being modified?

    HI all,
    I have a table in my web dynpro and several columns as checkbox... I put an event OnToggle in these columns.
    Do you know any way to get the row or the row number?
    If i use the method get_static_attributes return to me the selected row not the modified.
    Thanks in advance !

    EDIT: thanks ! is solved, i need to pass CONTEXT_ELEMENT' in the  <ELEMNT_NAME>
    This is my code:
    DATA table_element TYPE REF TO if_wd_context_element.
      DATA row_index TYPE i.
      table_element = wdevent->get_context_element('CONTEXT_ELEMENT').
      IF NOT table_element IS INITIAL.
        row_index = table_element->get_index( ).
      ENDIF.
    Edited by: Husalban RM on Sep 15, 2010 4:53 PM

  • BEX formula.. How to know the row value in formulas dynamically

    Hi all,
    I just need to clarify a doubt..
    Requirement:
    COL1      -               COL2
    Y1            -               X
    Y2            -               X + 12
    Y3            -               X + 12 + 12
    YN           -               X + 12 + 12 + u2026 12(n)
    Y is dynamic from the source datau2026.. Itu2019s the year (2009,2008u2026 etc..)
    X value is from the user (i/p variable value). Some dummy valueu2026
    Now, the main logic I want to incorporate is like using a formula for COL2
    COL2 Formula looks like thisu2026.          X + (12 * N)             where N= 0 for the 1st row; 1 for the 2nd row; 2 for the 3rd row like thatu2026..
    How to dynamically allocate value for N based on the row count?
    Pls. let me know if you find somethingu2026.
    Thanks.
    Edited by: Arun Bala G on May 21, 2010 10:59 AM

    how abt this:
    This approach only valid for Workbboks..
    create COLUMN3 just type like this
    0
    12
    24
    and drag this upto end of Col1 and Col2 so it will poulate multiples of 12 then in Column 4 apply the C1-C2+C3..
    hope it helps
    Sorry Bhaskar,
    Hardcoding the formula is not relevant at all. May be you had not read this query properly. Its no way related to being dynamic right... If it was Excel workbook, anyone would have used a simple formula & moved values like cakewalk.
    So unfortunate! BEx has some limitations..
    All I need in my query is some counter like 1,2,3.... till the end of the last record. That's all.
    Pl. find the sample data
    COL1     COL2          
    2009     1.3          
    2008     13.3          Which is 1.3+12
    2007     25.3          Which is 1.3+12+12
    2006     37.3          Which is 1.3+12+12+12
    Do let me know if you have any clues?
    Thanks!
    Edited by: Arun Bala G on May 21, 2010 11:20 AM

  • How to know the row and col numbers of a cell in JTable at mouseclicked

    Hi, I'm coding an app using swing and JTable, in this table I will display the records from a database, now, each time the user has click in any cell I want to display it value, whit this method:
        private void setpuntero(JTable table, int row, int col){
            Object o = table.getValueAt(row, col);
            System.out.println("Valor de la celda: "+o.toString());
    }The mouseclick event was coded like this:
                table.addMouseListener(new MouseAdapter() {
                    public void mouseClicked(MouseEvent e) {
                        setpuntero(table, 1, 3);
                });My question is:
    how in the mouseClicked I can pass to setpuntero() method the dynamic values of the cell that the user clicked?
    In this example, setpuntero(table, 1, 3); I have chosen the cell(1,3) to display the value, but really I don't know how to capture those values dinamically using the mouse click
    Regards
    Herbert

    perhaps:
          public void mouseClicked(MouseEvent e)
            int row = table.getSelectedRow();
            int col = table.getSelectedColumn();
            String selected = table.getValueAt(row, col).toString(); // this will need to be changed if not String data
          }

  • To fetch the rows based on selection criteria.

    Hi,
    1. For the same Ledger Number, if substr(UNIVCODE,1,1) contains both 'O' and 'D', then only the 'O' record need to be fetched.
    2. if substr(UNIVCODE,1,1) contains only 'O', then only the 'O' record need to be fetched.
    3. if substr(UNIVCODE,1,1) contains only 'D', then only the 'D' record need to be fetched.
    INPUT:
    LEDGERNO UNIVCODE     STATE
    000000003338     O 82P 000000003338      PA      
    000000003338     D P 000000003338      CA
    000000003338     O 11P 000000003338      CT
    000000212550     D P P00000212550      MI
    000000003345     O 12P 000000003345      UT
    Output:
    LEDGERNO UNIVCODE     STATE
    000000003338     O 82P 000000003338      PA      
    000000003338     O 11P 000000003338      CT
    000000212550     D P P00000212550      MI
    000000003345     O 12P 000000003345      UT
    Thanks for your time and Appreciate your help in this regard....
    Regards,
    Venkatesh

    with My_Tab as(
    select '000000003338' LEDGERNO, 'O' UNIVCODE, '82P 000000003338 PA' STATE from dual
    UNION ALL
    select '000000003338' LEDGERNO, 'D' UNIVCODE, 'P 000000003338 CA' STATE from dual
    UNION ALL
    select '000000003338' LEDGERNO, 'O' UNIVCODE, '11P 000000003338 CT' STATE from dual
    UNION ALL
    select '000000212550' LEDGERNO, 'D' UNIVCODE, 'P P00000212550 MI' STATE from dual
    UNION ALL
    select '000000003345' LEDGERNO, 'O' UNIVCODE, '12P 000000003345 UT' STATE from dual
    select *
    from My_Tab T1
    where (UNIVCODE = 'O'
           OR
            ( UNIVCODE = 'D'
              AND NOT EXISTS ( SELECT NULL FROM My_tab T2
                                Where T2.LEDGERNO = T1.LEDGERNO
                                    And   T2.UNIVCODE = 'O'
           )

  • How can I restrict the rows of a SELECT which uses analytical functions?

    Hello all,
    Can anyone please tell me how to restrict the following query:
    SELECT empno,
    ename,
    deptno,
    SUM(sal) over(PARTITION BY deptno) sum_per_dept
    FROM emp;
    I would need just the lines which have sum_per_dept>100, without using a SUBSELECT.
    Is there any way which is specific for analytical functions?
    Thank you in advance,
    Eugen
    Message was edited by:
    misailescu

    SQL> select empno,
      2  ename,
      3  deptno,sum_per_dept
      4  from
      5  (
      6  SELECT empno,
      7  ename,
      8  deptno,
      9  SUM(sal) over(PARTITION BY deptno) sum_per_dept
    10  FROM emp
    11  )
    12  where sum_per_dept>1000;
    EMPNO ENAME      DEPTNO SUM_PER_DEPT
    7839 KING           10         8750
    7782 CLARK          10         8750
    7934 MILLER         10         8750
    7902 FORD           20         6775
    7369 SMITH          20         6775
    7566 JONES          20         6775
    7900 JAMES          30         9400
    7844 TURNER         30         9400
    7654 MARTIN         30         9400
    7521 WARD           30         9400
    7499 ALLEN          30         9400
    7698 BLAKE          30         9400
    12 rows selected
    SQL>
    SQL> select empno,
      2  ename,
      3  deptno,sum_per_dept
      4  from
      5  (
      6  SELECT empno,
      7  ename,
      8  deptno,
      9  SUM(sal) over(PARTITION BY deptno) sum_per_dept
    10  FROM emp
    11  )
    12  where sum_per_dept>9000;
    EMPNO ENAME      DEPTNO SUM_PER_DEPT
    7900 JAMES          30         9400
    7844 TURNER         30         9400
    7654 MARTIN         30         9400
    7521 WARD           30         9400
    7499 ALLEN          30         9400
    7698 BLAKE          30         9400
    6 rows selected
    SQL> Greetings...
    Sim

  • How do I get the values from a selected row.

    I am using JDeveloper 9.0.5. On my page, I have placed a button within a table. The button has been assigned an event. The event is within my Action class. This class implements DataAction and has overriden the
    processComponentEvents(DataActionContext actionContext);
    method.
    Question: While I am within the processComponentEvents method, is it possible to obtain the values of selected row?

    Good Morning Jeffery,
    First off thanks for your clear explanation. I have a few related questions as noted from your response:
    There are two ways to communicate the desired model row between the UIX view and the struts controller. One way is to use the singleSelection component in your table and put your buttons in the singleSelection's contents.
    When the user selects the radio button for a particular row and then clicks on one the buttons, a built in event handler in UIX will set the current row in the model to be the user selected row. Therefore, your Struts action can operate on the currently selected model row.
    When you drop a UIX table from the data control palette it is automatically set up in this way (with a single selection).
    Ok, Lets say that i've set everything up as you described. Not lets say that the button was pressed and I hit the overriddenprotected void processComponentEvents(DataActionContext actionContext) throws IOException, ServletException ;
    When I look at the request object, I do not see the values. How do I get access to the rowkey at this point?
    Some people, however, want to actually render buttons in their table rows, and have those buttons initiate an action on their row. If you are doing this, then you need to pass the row id to your struts action as a parameter, which means that you need to know the row id when you are rendering a button for a given row. There is an EL expression that will return the row-id for the current row, it is:
    ${uix.current.rowKeyStr}
    which is not so obvious or well documented in the preview release (sorry) but should be for the production release.
    A generic code snippet would go a long way to shedding some light on that. I guess I am use to using JDeveloper 9.0.3. It seems,"to me", that JDev 9.0.5 has put a completely new twist on things. I find myself wondering when I can use the 9.0.3 syntax and when
    should not. If your team has any short source toys around which demonstrated using rowkeys, or accessing the internal parts of the
    struts controller, I would find that invaluable. It dose not matter if this information is documented.
    Thank you

  • How to get the position of a selected cell in a table without using the mouse event?

    Dear All,
        I have a question about table:After clicking the cell of a table, the cell is into the edit status. How to know the row number and column number of the cell, when I click a button?
       The link below is using the mouse down event:
       http://forums.ni.com/ni/board/message?board.id=170&message.id=260102&query.id=55917#M260102
       Is there any other way to do it? Having tried to using the "edit position"  property, but it seems not working well.
       Thanks for any suggestion.
    Hugo 
    Attachments:
    table.vi ‏17 KB

    It works well with the "edit position" property.
    See attached
    Attachments:
    table.vi ‏12 KB

  • How to know the number of rows of a ResultSet

    Hello.
    I'm trying to detect the number of rows of a query result before making all the results.next().
    Until know, my way was:
    ResultSet results = sql.executeQuery();
    while( results.next() )
    int i = 0;
    ... do stuff ...
    i++;
    out.println("The number of rows is: " + i);
    But I would like to know the value of 'i' just after 'executeQuery'.
    Does anybody have any experienc?
    Regards.

    How about like this???
    >
    ResultSet results = sql.executeQuery();results.last();
    i = results.getRow();
    results.first();
    while( results.next() )
    int i = 0;
    ... do stuff ...
    i++;
    out.println("The number of rows is: " + i);
    But I would like to know the value of 'i' just after
    'executeQuery'.
    Does anybody have any experienc?
    Regards.

  • How to get the number of the row added to tabular form by the AddRow()

    using 4.0. User clicks an Add button which calls a javascript function that gets a couple page item values, inserts a row (addRow(), and updates columns in that newly inserted row with the values from the page items. This works fine if I hard code the row number (so it saves the page item values into the row I specify) but I don't know how to get the row number of the newly inserted row?
    i.e html_GetElement('f12_0003').value = DocName; will set the element F12 at row 3 correctly, but I need to have the 0003 replaced with a variable that has its value set after addRow() but can't figure out how.

    hi,
    use the following code:
    CALL METHOD OF gv_selection 'Information' = gv_curpage
        EXPORTING
        #1 = 3. " get current page number
      CALL METHOD OF gv_selection 'TypeText'
        EXPORTING
        #1 = gv_curpage. "show current page number
      CALL METHOD OF gv_selection 'TypeText'
        EXPORTING
        #1 = ' of '.
      CLEAR gv_endpage.
      CALL METHOD OF gv_selection 'Information' = gv_endpage
        EXPORTING
        #1 = 4. "get total page number
      CALL METHOD OF gv_selection 'TypeText'
        EXPORTING
        #1 = gv_endpage. " show total page number
    Edited by: VoonHan on Oct 13, 2009 7:35 AM

  • How to get the row number

    Hi list,
    does any one know how I can get the row number the same as what I have in column rowno?
    thanks
    Arvin
    REATE   TABLE dbo.temptable
    ( y int  NOT NULL,
      e int not null,
      c int not null,
      rowno int not null)
    /* insert values  */
    INSERT INTO dbo.temptable(y,e,c,rowno ) VALUES
    (1,1,1,1),
    (1,1,2,1),
    (1,1,3,1),
    (1,20,1,2),
    (1,20,2,2),
    (1,20,3,2),
    (1,3,1,3),
    (1,3,1,3),
    (2,1,1,1),
    (2,1,1,1),
    (2,2,1,2),
    (2,2,1,2);

    You may update your rownumber column with Column "e".
    But why do you duplicate your data? May be there is no particular reason, you may be wasting space for it
    Try the below:
    CREATE TABLE dbo.temptable
    ( y int NOT NULL,
    e int not null,
    c int not null,
    ronum int null)
    INSERT INTO dbo.temptable(y,e,c ) VALUES
    (1,1,1),
    (1,1,2),
    (1,1,3),
    (1,20,1),
    (1,20,2)
    select * from temptable
    update dbo.temptable Set ronum=e
    Select * From dbo.temptable
    DRop table dbo.temptable

  • Getting the row and column number from the caretposition

    Howdy peeps
    Does anyone know how to find out the Line number and column in a JTextPane by using the caret position
    (you know like in text editors where it says 100:4 [line number:character position on row])
    is there a simple way of doing this in a JTextPane?

    im getting a bit confuzzled with this :(
    can someone help me out with a bit more code orientated help? :$
    i have a jTextArea and a JTextField, when i change the caret in the text area i want the JTextField to show the line number and charater position on the row (e.g. 100:4)
    so i assume i need to methods
    e.g.
    getPaneRow
    myint=myPane.getCaretPosition()
    do some wonderful magic code to get the line number
    return line number
    getPaneColumn
    myint=myPane.getCaretPosition()
    do some wonderful magic code to get the column number
    return column number
    is there a magician out there that can give me the magic powder? :)

Maybe you are looking for

  • How can i set different number of iterations for different scenario profiles that we add to "AutoPilot" in load testing of OATS

    Hi, I have few set of load test scenarios, I would like to add each of these test scenarios to "AutoPilot" and run each different scenario profile at different number of iterations. As in Oracle Load Testing the "Set Up AutoPilot" tab I see  a sectio

  • Showing Data in Oracle Discoverer Desktop

    Dear ALL, I am facing an issue in development of Relational reports in Oracle Discoverer Desktop. Following are the details of my warehouse (Data Mart) database: There are 2 Dimensions and 1 cube in the Data Mart. All the 2 dimensions and Cube are ba

  • File name as an XML field

    Does anybody knows how to include the file name into an XML field. My scenario is  XML file to JDBC. I have to pass the filename as one of the table field.

  • Why can't I resolve my "download error"?

    I just installed Adobe Indesign on my Mac. I'm not on a managed network (I'm at home), and I'm trying to access the 30 day subscription of Indesign that I just installed via Creative Cloud. My wife can access her adobe CC from her computer no problem

  • Events in oops

    hi, in handling events is it compulsory to create the class? because i tried to do that and it worked i.e without creating class.isnt it possible just by call method to print for e.g top of page?