ALV event ON_CLICK - find out selected row?

I have an ALV table and in one of the columns I display a linkToAction in each cell.
When the link is clicked, i go to the ON_CLICK event handler and try to find out, which row is selected.
For this, I can take the attribute "INDEX" of the parameter "R_PARAM", and read the context with the given index.
METHOD alv_event_on_click .
   DATA lo_nd_my_node    TYPE REF TO if_wd_context_node.
   DATA lt_my_table          TYPE wd_this->elements_my_table.
   DATA ls_my_structure    TYPE wd_this->element_my_struture.
*  click on prduct standard name link
   IF r_param->attribute = 'NAME_OF_THE_COLUMN'.
       lo_nd_my_node = wd_context->get_child_node( name = wd_this->wdctx_my_node ).
       lo_nd_my_node->get_static_attributes_table( IMPORTING table = lt_my_table ). "this is not sorted!!!!
       lo_nd_my_node->set_lead_selection_index( index = r_param->index ).
       READ TABLE lt_my_table INTO ls_my_structure INDEX r_param->index. "lt_my_table table might be sorted differently!!!!
       IF sy-subrc = 0.
         wd_this->do_something_with( ls_my_strcture ).
       ENDIF.
   ENDIF.
ENDMETHOD.
However, this does not work when I sort the ALV before!
For a strange reason, the table that I get from the context is not sorted the same way as the data in the ALV.
What can I do?

Hi Daniel,
I don't know if the external mapping messes things up.
Perhaps you could try the following:
lo_nd_my_node->get_static_attributes(
  EXPORTING
    index                = r_param->index
  IMPORTING
    static_attributes = ls_my_structure ).
It could be that passing the data towards your internal table doesn't take over the sort.
If you try debugging and check out the contents of the node, are they sorted correctly or not?
Regards and good luck.
Jos

Similar Messages

  • How to find out the rows inserted between a time period.

    Hi,
    Please help me to solve this.
    Table - emp.
    Colmns - empno(Primary Key),ename, mgr
    How to find out the rows inserted between a time period.
    For eg:- Between 02-Oct-2006 1 PM and 03-Oct-2006 2 PM.
    regards,
    Mathew.

    Hi,
    Maybe work:
    For each row, ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides
    e.g.:
    SGMS@ORACLE10> create table test(cod number);
    Table created.
    SGMS@ORACLE10> insert into test values (1);
    1 row created.
    SGMS@ORACLE10> insert into test values (2);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> insert into test values (3);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select SCN_TO_TIMESTAMP(ora_rowscn),ora_rowscn,cod from test;
    SCN_TO_TIMESTAMP(ORA_ROWSCN)       ORA_ROWSCN        COD
    06/11/06 08:56:56,000000000         727707205          1
    06/11/06 08:56:56,000000000         727707205          2
    06/11/06 08:57:05,000000000         727707210          3Cheers

  • ADF table: How to find out which rows were modified by the user

    Hi,
    I am using ADF table to display data that can be modified by the user (ReadOnly = false in the input text). I need to find out which rows were modified by the user, and only update (persist) those rows in the database.
    Is there an easy way to find out which rows were modified by the user.
    I am NOT particularly concerned with which columns were modified as I would update the entire row (if any data in that row is modified).
    I am using Oracle JDeveloper version 11.1.1.3.
    Thanks,
    Ash K

    Thanks Timo.
    I am using ADF Data Control (which are created from Web Service proxy) to display/update the data.
    In the backing bean, the operation that is invoked at the time persisting data is as follows:
    public void commitOperation {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("operationA");
    DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("someIterator");
    for(int i=0; i<dciter.getViewObject().getEstimatedRowCount(); i++)
    Row row=dciter.getRowAtRangeIndex(i);
    SomeObject someObject= new SomeObject ();
    someObject.setAttr1(row.getAttribute("Attrbute1").toString());
    someObject.setAttr2(row.getAttribute("Attribute2").toString());
    objectList.add(someObject);
    operationBinding.getParamsMap().put("param1", objectList);
    ResultObject result = (ResultObject) operationBinding.execute();
    Inside the for loop (or any other place in the backing bean), I would like to figure out if the row was modified by the user. Please let me know if how to get that. If ADF provides this automatically, that would be GREAT.
    Thanks,
    Ash K

  • PL/SQL-find out extra rows present in  table by comparing 2 similar tables

    Hi, can any one give me an idea to find out the extra rows present in table by comparing 2 similar tables using pl/sql.
    REQUIREMENT::i am working on the upgrade environment.my previous database has some tables and having data.Now functional folks are adding some new data to the existing tables for the upgrade database.I need to identify that new rows which are added by them.
    for this , i created name table with 2 columns n,n1 which contains the table names.
    Table Name:Name
    columns:n n1
    a ax
    b bx
    c cx
    a,b c........are the table names which are in the previous database environment.(approx >1500 tables)These tables having data.
    ax,bx,cx..........table names which are in the upgrade environment contains the extra data which is added by the functional folks.
    a&ax,b&bx.................(approx 1500 tables) are having same structure except some of them.
    Now i want to write a pl/sql program that reads both table names a&ax from name table and then by comparing the rows of a&ax ,i need to find out the extra rows present in the ax table to store that in different place.
    Example:
    a table
    id name
    1 co
    2 wi
    3 il
    ax table
    id name
    1 co
    2 wi
    3 il
    4 va
    5 ca
    Here i need to find out the difference b/n the 2 tables ,the extra rows id 4,5 and place it some where.

    this is just for demo, is this you mean?
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,ename,e.DEPTNO emp_deptno, d.deptno dept_deptno,d.DNAME
      2  FROM EMP e full outer join DEPT d
      3* on d.DEPTNO= e.DEPTNO
    SQL> /
         EMPNO ENAME      EMP_DEPTNO DEPT_DEPTNO DNAME
          7934 MILLER             10          10 ACCOUNTING
          7839 KING               10          10 ACCOUNTING
          7782 CLARK              10          10 ACCOUNTING
        snipp........
          7521 WARD               30          30 SALES
          7499 ALLEN              30          30 SALES
          156 1
    12 1
    40 OPERATIONS
    90 LOGISTIC
    18 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,ename,e.DEPTNO emp_deptno, d.deptno dept_deptno,d.DNAME
      2  FROM EMP e left outer join DEPT d
      3* on d.DEPTNO= e.DEPTNO
    SQL> /
         EMPNO ENAME      EMP_DEPTNO DEPT_DEPTNO DNAME
          7934 MILLER             10          10 ACCOUNTING
          7839 KING               10          10 ACCOUNTING
          7782 CLARK              10          10 ACCOUNTING
          7902 FORD               20          20 RESEARCH
        snipp..................
          7654 MARTIN             30          30 SALES
          7521 WARD               30          30 SALES
          7499 ALLEN              30          30 SALES
           156 1
    12 1
    16 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,ename,e.DEPTNO emp_deptno, d.deptno dept_deptno,d.DNAME
      2  FROM EMP e[b] right outer join  DEPT d
      3* on d.DEPTNO= e.DEPTNO
    SQL> /
         EMPNO ENAME      EMP_DEPTNO DEPT_DEPTNO DNAME
          7369 SMITH              20          20 RESEARCH
          7499 ALLEN              30          30 SALES
          7521 WARD               30          30 SALES
          7566 JONES              20          20 RESEARCH
          snipp......................
          7902 FORD               20          20 RESEARCH
          7934 MILLER             10          10 ACCOUNTING
                                             40 OPERATIONS
    90 LOGISTIC
    16 rows selected.

  • How to find out selected AssignedStory or Link?

    Hello to all,
    can anyone pls. explain how to find out which assigned story or link is selected at the time the script is fired.
    My problem is this: I would like to place an image into selected rectangle which is exported into .icml. So, for example, you have few exported rectangles and you would like to place an image into the one which is selected (through link or assignment panel). Because you can not select a rectangle in InCopy like you can in InDesign I tried to take a look through assigned stories...
                       For aCounter As Integer = 1 To myDocument.Assignments.Count
                            Dim myAssignment As InCopy.Assignment = myDocument.Assignments.Item(aCounter)
                            For sCounter As Integer = 1 To myAssignment.AssignedStories.Count
                                Dim myAssignedStory As InCopy.AssignedStory = myAssignment.AssignedStories.Item(sCounter)
                                Dim myStoryRef As Object = myAssignedStory.StoryReference
                                find out if assigned story or story reference is selected
                                'Rectangle
                                If TypeName(myStoryRef) = "Rectangle" Then
                                    Dim myObjectRectangle As InCopy.Rectangle = myStoryRef
                                    If myObjectRectangle.Graphics.Count = 0 And myObjectRectangle.Images.Count = 0 Then
                                        'CheckOut if needed
                                        'Place Media
                                    End If
                                End If
                            Next
                        Next
    Kind regards,
    Marko

    Well,
    I couldn't solve this without using a placeholder image. I found that you need to check if the selection is an image and than replace that image... So something like this below:
                    'Check if there is a selected image for relink
                    If myDocument.Selection.Count = 1 Then
                        If TypeName(myDocument.Selection.Item(1)) = "Image" Then
                            myImage = myDocument.Selection.Item(1)
                            myImageLink = myImage.ItemLink
                            Dim msgRet As MsgBoxResult = MsgBox("Would you like to relink selected image?", MsgBoxStyle.YesNoCancel, "Relink seleceted image?")
                            If msgRet = MsgBoxResult.Yes Then
                                        ' DO some action
                                        Dim MediaLink As String = something...
                                                'CheckOut action
                                                If myCheckOutMenu.AssociatedMenuAction.Enabled() Then
                                                    myCheckOutMenu.AssociatedMenuAction.Invoke()
                                                End If
                                                myImageLink.Relink(fileLink)
                                                Try
                                                    myImageLink.Update()
                                                Catch
                                                End Try
    Hope this helps.
    Regards,
    Marko

  • Finding and selecting rows JTable

    Hey all!
    Im having a bit of trouble with my JTable, I have a JInternalFrame which holds a JTable and a "Find" button, once you press the Find button a seperate JFrame pops up and searches the JTable for the information entered, but it just gives a JOptionPane saying that it was found at row 'n'
    What i want instead of the JOptionPane is for the JFrame to stay open (so you can Find Next) and for the row that has the information to be highlighted/selected
    Any ideas on this would be great,
    Thanks in advance

    write for a class `search` with constructor
    search(myTable tab)
    onClick event of the button pass table object to the search constructor
    public void actionPerformed(ActionEvent e)
    search s=new search(mainTable);//<--Your table object
    }now whatever you do for that object you can handle the main
    table object.
    use this to select cell
    table.changeSelection(row,col,false,false);
    In class search add passed table in the frame

  • How to find out the rows inserted in the last n minutes ?

    Hi all,
    I have a log table where, every time a warning is issued, a new row is added. The table has a field with the sysdate when the warning was issued.
    I'd need to collect all warnings in the last (supposing) 30 minutes and send a mail to the administrator. Looking at some faqs I have elaborated this:
    select * from PROCEDURE_LOGS p where ((p.DATE_LOG - sysdate)*-1440) < 30
    However this does not produce anything.
    Can anybody help me to correct this statement ?
    Thanks a lot
    Frank

    Hi, Frank,
    That looks okay to me. Are you sure you have rows in the table with a date_log in the last 30 minutes? Post some sample data (CREATE TABLE and INSERT statements), and the results you expect from that data for a given value of SYSDATE.
    By the way, you can make the WHERE clause clearer like this:
    select     *
    from      PROCEDURE_LOGS     p
    where      ( (sysdate - p.DATE_LOG)
         * 1440           -- = 24 * 60
         ) < 30but this won't change the results.
    Edited by: Frank Kulash on Dec 1, 2010 9:51 AM
    I just saw Toon's reply:
    where     p.DATE_LOG > sysdate - (30 / 1440)as Toon suggested, is clearer still, and potentially more efficient if ther's an index on date_log.

  • Find out duplicate rows in a flat file before using sqlldr

    Hello i want to import via sqlldr from a flat file to a table inside my data base. My flat file has unfortunately some duplicate copies inside. So, i defined my upload table with two primary keys- date and time(and sometimes there are more than one row with the same time and date inside the flat file). These primaries are important to me because i want to use them for later tables and i can't use the direct path and parallel method by using primaries.
    Is there any tool which can find duplicate copies before i use sqlldr. But, the special case here is, that the rows not really duplicated but date and time rows twice. And for my interest it isn't necessary whether there are different values in the second row of the same date and time. The file contains data which is monitored every second and that's enough.
    It would be nice if someone could help me
    cheers

    I simply upload from sqlldr to staging tables first.
    The staging tables allow duplicates then I do what I need to do in regards to duplicates or missing data during the transfer from the staging tables to the real tables.
    The staging tables are also global temporary tables so I don't have to worry about cleaning them up or multiple sessions trampling each other.
    I have also used an external table on the datafile instead of sqlldr, this allows me to get rid of the staging table. But that is only good for very small datasets in the file being loaded.

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • Evaluate multiple selected rows within ABAP WD ALV

    Hi,
    I am using ALV within WebDynpros for ABAP. It's easily possible for users to select multiple rows. Subsequently I'd like to process only the selected rows further. How would I find out, which rows were selected?
    There should be a standard way via wd_this or wd_context, I don't seem to have found it yet.
    All ideas are appreciated.
    Regards, Rene

    Hi Rene,
    If you use external context binding to pass the table, the information of the selected rows should be available in the context node you passed (Get_Selected_elements).
    Ciao, Regina

  • Making  selected rows to display mode in ALV  grid

    I Have program with ALV grid display, which has check box as the first field.
    The requirement is like.
    When i select some rows in the grid display with the check box and click on a button , then the selected
    rows shud change to display mode and others rows shud be in edit mode as before.
    *& Report  ZSRI_CHCKBOX_ITAB_UPDATE
    REPORT  ZSRI_CHCKBOX_ITAB_UPDATE.
    TYPE-POOLS: SLIS.
    DATA: BEGIN OF ITAB OCCURS 0,
            CHK    TYPE C,
            VBELN  TYPE VBAP-VBELN,
            POSNR  TYPE VBAP-POSNR,
            MATNR  TYPE VBAP-MATNR,
            MATWA  TYPE VBAP-MATWA,
            MATKL  TYPE VBAP-MATKL,
          END OF ITAB.
    DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
          W_FCAT TYPE SLIS_FIELDCAT_ALV,
          RT TYPE SLIS_SELFIELD,
          W_LAYOUT TYPE SLIS_LAYOUT_ALV  .
    PARAMETERS: S_VBELN TYPE VBAK-VBELN.
    DATA: WA LIKE LINE OF ITAB.
    DATA: G_GRID_REFERENCE TYPE REF TO CL_GUI_ALV_GRID.
    DATA: BEGIN OF ITAB1 OCCURS 0,
            CHK    TYPE C,
            VBELN  TYPE VBAP-VBELN,
            POSNR  TYPE VBAP-POSNR,
            MATNR  TYPE VBAP-MATNR,
            MATWA  TYPE VBAP-MATWA,
            MATKL  TYPE VBAP-MATKL,
          END OF ITAB1.
    DATA: T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV.
    DATA: W_FCAT1 TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
      SELECT VBELN POSNR MATNR MATWA MATKL FROM VBAP
        INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE   VBELN EQ S_VBELN.
      W_FCAT-COL_POS = 1.
      W_FCAT-FIELDNAME = 'CHK'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-CHECKBOX = 'X'.
      W_FCAT-EDIT = 'X'.
      W_FCAT-SELTEXT_L  = 'CHECK'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 2.
      W_FCAT-FIELDNAME = 'VBELN'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'SALES'.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 3.
      W_FCAT-FIELDNAME = 'POSNR'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'ITEM'.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 4.
      W_FCAT-FIELDNAME = 'MATNR'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'MATERIAL'.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 5.
      W_FCAT-FIELDNAME = 'MATWA'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'MATERIAL QTY'.
      W_FCAT-OUTPUTLEN = 20.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS = 6.
      W_FCAT-FIELDNAME = 'MATKL'.
      W_FCAT-TABNAME = 'ITAB'.
      W_FCAT-SELTEXT_L  = 'MATERIAL GROUP'.
      W_FCAT-OUTPUTLEN = 20.
      W_FCAT-EDIT = 'X'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = SY-REPID
         I_CALLBACK_PF_STATUS_SET          = 'STATUS1'
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                         = W_LAYOUT
         IT_FIELDCAT                       = T_FCAT[]
        TABLES
          T_OUTTAB                          = ITAB[].
    *&      Form  STATUS1
    FORM STATUS1 USING P_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STATUS1' EXCLUDING P_EXTAB.
    ENDFORM.                    "PF_STATUS_SET
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM TYPE SY-UCOMM
                            R_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'READ'.
    R_SELFIELD-REFRESH = 'X'.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              E_GRID = G_GRID_REFERENCE.
          CALL METHOD G_GRID_REFERENCE->CHECK_CHANGED_DATA.
          LOOP AT ITAB INTO WA WHERE CHK = 'X'.
            APPEND WA TO ITAB1.
          ENDLOOP.
          W_FCAT1-COL_POS = 1.
          W_FCAT1-FIELDNAME = 'CHK'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-CHECKBOX = 'X'.
          W_FCAT1-SELTEXT_L  = 'CHECK'.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 2.
          W_FCAT1-FIELDNAME = 'VBELN'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'SALES'.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 3.
          W_FCAT1-FIELDNAME = 'POSNR'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'ITEM'.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 4.
          W_FCAT1-FIELDNAME = 'MATNR'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'MATERIAL'.
          W_FCAT-OUTPUTLEN = 20.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 5.
          W_FCAT1-FIELDNAME = 'MATWA'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'MATERIAL TYPE'.
          W_FCAT-OUTPUTLEN = 20.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          W_FCAT1-COL_POS = 6.
          W_FCAT1-FIELDNAME = 'MATKL'.
          W_FCAT1-TABNAME = 'ITAB'.
          W_FCAT1-SELTEXT_L  = 'MATERIAL GROUP'.
          W_FCAT-OUTPUTLEN = 20.
          APPEND W_FCAT1 TO T_FCAT1.
          CLEAR W_FCAT1.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
              I_CALLBACK_PROGRAM = SY-REPID
              IT_FIELDCAT        = T_FCAT1[]
              IS_LAYOUT          = W_LAYOUT
            TABLES
              T_OUTTAB           = ITAB[].
    CLEAR ITAB1.
    CLEAR ITAB1[].
    CLEAR T_FCAT1.
    CLEAR T_FCAT1[].
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Edited by: dharmaji Srinivasu on Feb 6, 2009 1:22 PM

    Hi
    Check out the following links:
    http://www.sapdev.co.uk/reporting/alv/alvgrid_rowsel.htm  " To obtain selected rows
    http://www.sapdev.co.uk/reporting/alv/alvgrid_editable.htm  "To make cells editable
    In the case stmt for particular button you can do:
    loop at itab into wa.
          if wa-sel EQ 'X'.
          Process records that have been selected
          endif.
    endloop.
    Hope this helps
    Regards,
    Jayanthi.K

  • [UIX-ADF] How to get the selected row in my ViewObjImpl.java

    Hi,
    I have a uix table with a select column. I dragged my method from my ViewObjImpl
    and dropped it on the select column (radiobutton) as a submitbutton.
    If I run my application and select a row and press my button it always reads the first
    row. Why?
    I also tried including a param in my method, for the record id, but I dont know what to
    pass to my action binding as a param, where can I find the selected row?
    This is what I want, my method in ViewObjImpl.java
    public void doDelete() {
      ViewObjRowImpl pRow = (ViewObjRowImpl)this.getCurrentRow();
      try {
        pRow.setIsDeleted("Y");
        //this.executeQuery();
        this.getDBTransaction().commitAndSaveChangeSet();
        //this.validate();
      } catch(Exception e) { System.out.println("ERROR doDelete" + e);  }
    }It should set the IsDeleted field to 'Y' for the selected row. Perhaps im not doing the
    right thing for this?
    Can anyone give me some pointers?
    Thanks in advance
    Ido

    Thanks. So even if you select a row and then press the button, your method still only finds the first row?!
    Are you sure that the selection mechanism of your table is working? Your tableSelection fires a select event and your page contains a select handler?
    When you wire your page using drag and drop the binding should always use the default iterator of the ViewObject. And getCurrentRow() should always give you the current row of that iterator. So my feeling is that the selection doesn't take place.
    Or could it be that something resets the currency in the ViewObject from another place?
    Sascha

  • How to get selected Row/Cell value in i5Grid

    Hi Friends,
    Can anyone help to how to find the selected Row/Cell value of a i5Grid object. I am able to register the event handlers which are getting invoked on row/cell selection. But I want to know how can I get the value of selected Cell/Row. I would like to add selected Items from one i5Grid to another one.
    So want to know how can I get and set the value of i5Grid object.
    MII version 14.0 SP4 Patch
    Thank in advance
    Shaji Chandran

    Hi Shaji,
    Here is my code.
    <!DOCTYPE HTML>
    <HTML>
    <HEAD>
        <TITLE>Your Title Here</TITLE>
        <META http-equiv="X-UA-Compatible" content="IE=edge">
        <META http-equiv='cache-control' content='no-cache'>
        <META http-equiv='expires' content='0'>
        <META http-equiv='pragma' content='no-cache'>
        <SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid,i5SPCChart"></SCRIPT>
        <SCRIPT>
            var Grid = new com.sap.xmii.grid.init.i5Grid("STC/C5167365/i5Grid_TagQuery", "STC/C5167365/TagQuery");
            Grid.setGridWidth("640px");
            Grid.setGridHeight("400px");
            Grid.draw("div1");
        function setCellValue()
        Grid.getGridObject().setCellValue(1,1,"Set");
        function setCellValueAgain()
        Grid.getGridObject().setCellValue(1,1,"Changed Again");
        </SCRIPT>
    </HEAD>
    <BODY>
        <DIV id="div1"></DIV>
        <INPUT type="Button" value="setCellValue" onClick="setCellValue()"/>
        <INPUT type="Button" value="setCellValueAgain" onClick="setCellValueAgain()"/>
    </BODY>
    </HTML>
    Regards,
    Sriram

  • Get selected rows using the fm REUSE_ALV_GRID_DISPLAY_LVC

    FYI ... for all those developers trying to select multiple rows in an ALV report, and get the selected rows - without using the OO approach to display to ALV, and without using checkboxes in the function module approach.  First off, you need to use the function module REUSE_ALV_GRID_DISPLAY_LVC instead of the standard REUSE_ALV_GRID_DISPLAY.  This allows you to select multiple rows using the toggle, line selection buttons, at the start of each row (with 'select all' button).  See the sample code below.  If you are converting from the one fm to the other, you will have to change the type of 2 of the structures to the 'LVC' structures and make minor code changes.  The example code below was initially using the REUSE_ALV_GRID_DISPLAY fm, and was converted to use REUSE_ALV_GRID_DISPLAY_LVC  to allow for multiple row selection.  The next step is to create a custom status, with a new custom button, that will start the processing of the selected rows.  Go to tcode SE41, press Copy Status, and copy program SAPLKKBL, status STANDARD, to your custom program (same name as the custom ALV rpt) and a new status name (ie STANDARD1).  In the new STANDARD1 status for the custom ALV program/rpt (tcode SE41), add a new button ('&EXE') at the end of the std buttons (items 29-35).  Assign the new button a Text, Icon and a Function Key. Thats it!
    Here's the code:
    FORM display_data.
    DATA:
      wa_callback_program LIKE sy-repid,
      wa_layout      TYPE lvc_s_layo,  "was  slis_layout_alv,       "D01K913690
      t_fieldcat        TYPE lvc_t_fcat,   "was  slis_t_fieldcat_alv,  "D01K913690
      wa_fieldcat    TYPE lvc_s_fcat,  "was  slis_fieldcat_alv,     "D01K913690
      t_excluding     TYPE slis_t_extab,
      wa_excluding TYPE slis_extab,
      wa_variant     LIKE disvariant.
    * Setup Field Catalog
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZBUKR'.
      wa_fieldcat-ref_field    = 'ZBUKR'.
      wa_fieldcat-ref_table   = 'REGUT'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'BANKS'.
      wa_fieldcat-ref_field   = 'BANKS'.
      wa_fieldcat-ref_table  = 'REGUT'.
      APPEND wa_fieldcat TO t_fieldcat.
    * Setup other ALV fm parameters
      CLEAR wa_excluding.
      wa_excluding-fcode = '&F12'.
      APPEND wa_excluding TO t_excluding.
      CLEAR wa_excluding.
      wa_excluding-fcode = '&F15'.
      APPEND wa_excluding TO t_excluding.
    * Callback program
      wa_callback_program = sy-repid.
    * List layout
      wa_layout-zebra = 'X'.
      wa_layout-sel_mode = 'A'.
    * variant
      wa_variant-variant  = p_var.
    * Display the ALV report
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'                "D01K913690
           EXPORTING
                i_callback_program             = wa_callback_program
                i_callback_pf_status_set    = 'SET_PF_STATUS'              "D01K913690
                i_callback_user_command  = 'USER_COMMAND'
                is_layout_lvc                       = wa_layout                          "D01K913690
                it_fieldcat_lvc                      = t_fieldcat                            "D01K913690
                it_excluding                         = t_excluding
                i_save                                 = 'A'
                is_variant                            = wa_variant
           TABLES
                t_outtab                              = t_regut
    *      EXCEPTIONS
    *           PROGRAM_ERROR            = 1
    *           OTHERS                             = 2
    ENDFORM.                               " DISPLAY_DATA
    FORM user_command
      USING
        r_ucomm     LIKE sy-ucomm
        rs_selfield TYPE slis_selfield.
      DATA: wa_text(80) TYPE c.
      CASE r_ucomm.
        WHEN '&EXE'.   "User pressed custom Execute button
          DATA ref1 TYPE REF TO cl_gui_alv_grid.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              e_grid = ref1.
          DATA: lt_index_rows TYPE lvc_t_row,
                     lt_row_no TYPE lvc_t_roid,
                     lw_row_no TYPE lvc_s_roid.
          CALL METHOD ref1->get_selected_rows
            IMPORTING
              et_index_rows = lt_index_rows
              et_row_no     = lt_row_no.
          LOOP AT lt_row_no
             INTO lw_row_no.
             *** CODE TO PROCESS EACH RECORD FROM MULTIPLE SELECTED***
          ENDLOOP.  "loop at lt_row_no
        WHEN '&IC1'.  "User double-clicked on row
          *** CODE TO PROCESS SINGLE RECORD SELECTED ***
        WHEN '&F03' .          " back
          SET SCREEN 0. LEAVE SCREEN.
        WHEN '&F15' .          " exit
          SET SCREEN 0. LEAVE SCREEN.
        WHEN '&F12' .          " cancel
          SET SCREEN 0. LEAVE SCREEN.
      ENDCASE.
    ENDFORM.                               " USER_COMMAND
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STANDARD1'.
    ENDFORM. " set_pf_status
    Hope this helps ...
    Regards,
    Kevin
    Moderator message - Welcome to SCN.
    However, as you can see, the forum software was unable to format this because of the 2,500 character posting limit. since this looks interesting, would you please try to edit to conform to that limitation? You may try to split it into an initial post and a response.
    Edited by: Rob Burbank on Jul 8, 2009 1:39 PM

    Hi ,
         Make it use in your code and let me know if u have any concerns...
        Use "Subtotal_text" in events table.
    here GTOTAL is field in itab on which we sortindf data, and use your own field on which field u want to sort...
    refresh gt_event.
    clear gw_event.
    call function 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type = 0
       IMPORTING
         et_events   = gt_event.
    Subtotal
    read table gt_event with key name = slis_ev_subtotal_text into gw_event.
    if sy-subrc = 0.
       move 'SUBTOTAL_TEXT' to gw_event-form.
       append gw_event to gt_event.
    endif.
         form subtotal_text using uw_subtot_line type ty_main
                    uv_subtottxt type slis_subtot_text.  "#EC CALLED
    if uv_subtottxt-criteria = 'GTOTAL'.
       uv_subtottxt-display_text_for_subtotal = 'TOTAL'.
    endif.
         *FORM build_sort .
    refresh gt_sort.
    gw_sort-spos      = 1.
    gw_sort-fieldname = 'GTOTAL'.
    gw_sort-tabname   = 'GT_MAIN'.
    gw_sort-up        = 'X'.
    gw_sort-subtot    = 'X'.
    APPEND gw_sort TO gt_sort.
    CLEAR gw_sort.
    Reward points once its useful..

  • How to save the selected row number to NSUserDefaults

    I am trying to save the indexpath.row of the selected row to NSUserDefaults temporarily until my detail view controller can load its UITextFields based on which row is tapped. First of all is this good? I chose this design because the detail view controller cannot access the master view controller so I can't find out which row its tapped. To save to NSUSerDefaults, I did the following code, and the NSLog is always returning row 0 no matter what row I tap. Plus the title is not being set: its still blank.
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        [patientList deselectRowAtIndexPath:indexPath animated:YES];
        [[NSUserDefaults standardUserDefaults] setInteger:indexPath.row forKey:@"rowSelected"];
        NSLog(@"The selected row saved is row %d"), [[NSUserDefaults standardUserDefaults] integerForKey:@"rowSelected"];
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
            PatientDetailViewController *detailViewController = [[PatientDetailViewController alloc] initWithNibName:@"PatientDetailViewController" bundle:nil];
            detailViewController.title = [patientDisplayName objectAtIndex:[[NSUserDefaults standardUserDefaults] integerForKey:@"rowSelected"]];
            // Pass the selected object to the new view controller.
            [self.navigationController pushViewController:detailViewController animated:YES];
            [detailViewController release];

    I have also tried setting the title differently (I also added comments to explain each line what it does, the rest is the same), but neither methods work
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        // Deselect the row
        [patientList deselectRowAtIndexPath:indexPath animated:YES];
        // Save to memory the row selected
        [[NSUserDefaults standardUserDefaults] setInteger:indexPath.row forKey:@"rowSelected"];
        // Show saved row to make sure it saved correctly
        NSLog(@"The selected row saved is row %d"), [[NSUserDefaults standardUserDefaults] integerForKey:@"rowSelected"];
        // Check if user is using iPhone
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
            // Load the view
            PatientDetailViewController *detailViewController = [[PatientDetailViewController alloc] initWithNibName:@"PatientDetailViewController" bundle:nil];
            // Set the title of the detail view controller based on row selected
            detailViewController.title = [patientDisplayName objectAtIndex:indexPath.row];
            // Push the detail view controller
            [self.navigationController pushViewController:detailViewController animated:YES];
            // Release the detail view controller
            [detailViewController release];

Maybe you are looking for