Detect selected row/column in ALV when clicking my button

Hello,
I use the cl_salv_table to display my ALV. I have implemented some double click events an so one. But now I like to be able detect u201Cselected  row and coll when I press a button I my Application toolbar.
How do I get the selected row/column when pressing my button?
Regards,
Kenneth

Give this a try:
class lcl_disp_code definition.
  public section.
    methods: disp_code
               for event double_click
               of cl_gui_alv_grid
               importing es_row_no
                         e_column.
endclass.                    "lcl_disp_code DEFINITION
*       CLASS lcl_disp_code IMPLEMENTATION
class lcl_disp_code implementation.
  method disp_code.
    perform restrict_data
      using es_row_no-row_id.
  endmethod.                    "on_double_click
endclass.                    "lcl_disp_code IMPLEMENTATION
Rob

Similar Messages

  • Edit a selected row in an alv report after pressing a push button ?

    hi all ,
    I want to edit a selected row in an alv report but that too after i press a push button . After pressing the push button , a pop up shud *** showing all the entries of the selected row which shud be editable and after editing it shud be saved into the database table.
    How can i do this please help asap ???

    May this prog. of mine can solve your requirement.
    REPORT z_demo_alv_jg.
    TYPE-POOLS                                                          *
    TYPE-POOLS: slis.
    INTERNAL TABLES/WORK AREAS/VARIABLES                                *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
          w_field TYPE slis_fieldcat_alv,
          p_table LIKE dd02l-tabname,
          dy_table TYPE REF TO data,
          dy_tab TYPE REF TO data,
          dy_line TYPE REF TO data.
    FIELD-SYMBOLS                                                       *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY,
                   <dyn_field> TYPE ANY,
                   <dyn_tab_temp> TYPE STANDARD TABLE.
    SELECTION SCREEN                                                    *
    PARAMETERS: tabname(30) TYPE c,
                lines(5)  TYPE n.
    START-OF-SELECTION                                                  *
    START-OF-SELECTION.
    Storing table name
      p_table = tabname.
    Create internal table dynamically with the stucture of table name
    entered in the selection screen
      CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc <> 0.
        MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
        LEAVE TO LIST-PROCESSING.
      ENDIF.
    Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Create another temp. table
      CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_tab->* TO <dyn_tab_temp>.
      SORT i_fieldcat BY col_pos.
    Select data from table
      SELECT * FROM (p_table)
      INTO TABLE <dyn_table>
      UP TO lines ROWS.
      REFRESH <dyn_tab_temp>.
    Display report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *&      Form  SET_PF_STATUS
          Setting custom PF-Status
         -->RT_EXTAB   Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STANDARD'.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  user_command
          Handling custom function codes
         -->R_UCOMM      Function code value
         -->RS_SELFIELD  Info. of cursor position in ALV
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
    Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.
      CASE r_ucomm.
      When a record is selected
        WHEN '&IC1'.
        Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.
          IF sy-subrc = 0.
          Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
          Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.
            Make all the fields input enabled except key fields
              w_field-input = 'X'.
              MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.
            ENDIF.
          Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.
            IF sy-subrc = 0.
            Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
            If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.
          ENDIF.
      When save button is pressed
        WHEN 'SAVE'.
        Sort the index table
          SORT i_index.
        Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.
          LOOP AT i_index.
          Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.
          ENDLOOP.
        Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.
          IF sy-subrc = 0.
          Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
            REFRESH <dyn_tab_temp>.
          Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.
          ENDIF.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    Regards,
    Joy.

  • SAPGUI JAVA 7.10 (OSX 10.5.1): cannot select multiple columns in ALV

    Hi,
    in sapgui java 7.10 (on mac osx 10.5.1) I cannot select multiple columns in ALV reports.
    I can do it only in some transactions (like SE16). But on all our custom reports (REUSE_ALV_GRID_DISPLAY) in does not work.
    Any hint?
    Many thanks,
    Lorenzo

    Hi Lorenzo,
    did you double check if selecting multiple columns works with SAP GUI for Windows in the same report?
    If yes, I suggest to file a bug report so we can do a remote logon to run your custom report.
    If not it might be because of REUSE_ALV_GRID_DISPLAY itself or your parameters calling REUSE_ALV_GRID_DISPLAY.
    Best regards
    Rolf-Martin

  • How to delete the selected rows in a JTable on pressing a button?

    How to delete the selected rows in a JTable on pressing a button?

    You are right. I did the same.
    Following is the code where some of them might find it useful in future.
    jTable1.selectAll();
    int[] array = jTable1.getSelectedRows();
    for(int i=array.length-1;i>=0;i--)
    DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
    model.removeRow(i);
    }

  • How to switch to another page when clicking a button

    I have a main frame consits of many button.What I need to do when click
    a button,it switch to another page?
    Thanx....

    Try this, it should work.
    // not tested
    JButton linkButton = new JButton("<html><a href=\"http://forum.java.sun.com\">link to<br>forum</a></html>");

  • How to display the details of particular order when click on button in sapui5

    Hi Experts,
        How to display the details of particular order when click on button in sapui5?
    I Have a requirement that is i want display all the list of orders coming from backend as shown in image below
    then in that i have a button when i press the button  it need to display the details of particular order as shown in image below
    Please help me .
    Thanks & Regards
    chitti

    Does anyone know how to display the index of current desktop?
    Brute force - - I have written the number of the Desktop directly onto the wallpaper picture I am using for each Desktop  (easy to do with Preview).
    All Desktops are using different wallpaper photos, so they are easily recognized by the color scheme, and in the upper left corner is the number.
    Regards
    Léonie

  • Microsoft Expression Encoder 4 crashes when clicking Start button to begin live smooth streaming to a publishing point created in Windows Server 2012

    Microsoft Expression Encoder 4 crashes when clicking Start button to begin live smooth streaming to a publishing point created in Windows Server 2012, I've got the following error. Can anyone help me with this? Thanks in advance!
    Nombre del evento de problema:    CLR20r3
      Firma del problema 01:    encoder.exe
      Firma del problema 02:    4.0.4276.0
      Firma del problema 03:    4eafa0d7
      Firma del problema 04:    mscorlib
      Firma del problema 05:    4.0.30319.18408
      Firma del problema 06:    52310b91
      Firma del problema 07:    3e69
      Firma del problema 08:    0
      Firma del problema 09:    System.InvalidCastException
      Versión del sistema operativo:    6.2.9200.2.0.0.272.7
      Id. de configuración regional:    3082
      Información adicional 1:    5861
      Información adicional 2:    5861822e1919d7c014bbb064c64908b2
      Información adicional 3:    dac6
      Información adicional 4:    dac6c2650fa14dd558bd9f448e23afd1
    Lea nuestra declaración de privacidad en línea:
      http://go.microsoft.com/fwlink/?linkid=190175
    Si la declaración de privacidad en línea no está disponible, lea la declaración de privacidad sin conexión:
      C:\Windows\system32\es-ES\erofflps.txt

    2014-12-17 16:05:41  Msg 5170, Level 16, State 1, Server \\.\pipe\Microsoft##WID\tsql\query,  Line 2
    Cannot create file 'C:\Windows\WID\Data\SUSDB.mdf' because it already exists
    Looks like somebody forgot to remove the database from the last time WSUS was installed.
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

  • How to hide a TextField when clicking another button

    Hello!
    I've been able to generate a TextField to appear when clicking a button, but when I click on another button, to display some more information, I still have the first TextField displayed.  I've had a look around, but not been able to find anything to help me with getting the first to disappear.  Can anyone provide any ideas for this?
    The code I'm using for displaying the TextField is:
    button10.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    var fl_TF:TextField;
    var fl_TextToDisplay:String = "Send disply to the right screen/projector";
    function fl_ClickToPosition(event:MouseEvent):void
    fl_TF = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.LEFT;
    fl_TF.background = true;
    fl_TF.border = true;
    fl_TF.x = 300;
    fl_TF.y = 100;
    fl_TF.text = fl_TextToDisplay;
    addChild(fl_TF);
    Many thanks in advance

    all your buttons should call the same function. 
    because each button probably triggers different text to be displayed, you can use an object or dictionary to associate the buttons and their text:
    // execute these two lines and your function once at the start of your app
    var dictionary:Dictionary=new Dictionary(true);
    var fl_TF:TextField;
    function fl_ClickToPosition(event:MouseEvent):void
    if(fl_TF&&fl_TF.parent){  /
    fl_TF.parent.removeChild(fl_TF);
    fl_TF=null
    fl_TF = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.LEFT;
    fl_TF.background = true;
    fl_TF.border = true;
    fl_TF.x = 300;
    fl_TF.y = 100;
    fl_TF.text = dictionary[e.currentTarget];
    addChild(fl_TF);
    ////////// and for each button use something like:
    button10.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    dictionary[button10] = "Send disply to the right screen/projector";

  • 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

  • How to get the selected rows & columns in the table?

    hi everybody,
                         In my application the table is kept inside the event structure.I select the cells  in the table (using mouse) on running time.How to get the selected number of rows & columns in that table?

    Hello,
    You can fill selected values of the table by writing to it or the corresponding property using a property node - the table is just a 2D array of strings.  I think for your "disable" question you are referring to the shortcut menu (when you right click).  If you are using LabVIEW 8.x, you can edit or disable that shortcut menu - just right click on your table at edit time and choose Advanced >> Run-Time Shortcut Menu.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • Open system form and select a row number on matrix by click on button

    Hi experts,
    I have to open the purchase order form and select a specific row number from the matrix by clicking a button on sales order form.
    is it possible ?
    can anyone help me to achieve it?
    Thanks in advance.
    Best regards
    Andrea

    Andrea,
    To Do? Clicking on a Button on Sales Order -> Opens a PO form, and selects the row?
    In the eventhandler of a button click if the PO is not linked to SO by SAP B1 standard functionality
    step 1. call ActivateMenu ("2305") of Sbo_application , this opens the PO form
    step 2. Change the form to Find mode
    step 3. enter po number to the Item UID "8" which is the document number.
    step 4. Send enter key, or Clikc On button UID "1" which finds the PO
    step 5.read the value from SO form, from matrix "38" line where you selected
    step 6. use the code above to locate the line in PO (use # column for position numbers which UID is 0)
    at step 5, i think you should select a line from SO matrix which you would like to open.
    IN sales order, If you used PO chekcbox on logistics tab to create the PO, you can find a direct link between PO and SO (only in docentries are linked not positions) on sales order,  Column UID 158 field name: potrgnum.  If this connection is exists, you have an easy way:
    SO form, when a user clicks on COlumn 158 (po number), you can implement an eventhandler, which
    step 1.read the value from SO form, from matrix "38" line where you selected
    step 2. use the code above to locate the line in PO (use # column for position numbers which UID is 0)
    By processing theses steps, you can build up you solution.
    Regards
    János

  • How to reference the selected row on a report by click a radiobox

    I created a report with a column displayed as a radiobox.The report source is like "select htmldb_item.radiogroup(1,.....),rec_id,....from .... where ....",after click one radiobox,i want to get other column's value in the selected row in the after submit process ,can anyone help me?????? how to reference "rec_id" of the selected row?

    Hello,
    First, please tell us your first name, and update your forum handle. It’s make it easier to track your threads, and help you.
    >> apex_application.g_f01(1)" only return the first record's rec_id,if i click radiobox in other rows,it returns the same result as click radiobox in the first row?
    The ‘G_F01’ is an array of values, so apex_application.g_f01(1) will always bring you the first element of this array. If you want to retrieve other values from this array, which will include the values of the radiogroup value of the other lines, you need to use a loop. Something like that should work:
    for i in 1.. apex_application.g_f01.count loop
    … apex_application.g_f01(i) …
    end loop;
    >> after click one radiobox,i want to get other column's value in the selected row in the after submit process
    That means that the value of your radiogroup item should include some indication to the line you are on. If, like in Andy’s example, you can retrieve your record from a table, based on a PK, your radiogroup can return this kind of information. However, if the data on the other columns of the select raw, were just entered/updated by the user (like in a tabular form), the radiogroup item should include information about the row you are in, in order for you to be able to access the corresponding array elements – other G-Fxx arrays – of the other columns in the row. In this case, I believe using checkboxes is preferable.
    Regards,
    Arie.

  • Re: Getting the current selected Row & column in adf table

    Hi,
    Our requirement is we have to retrieve both the current row and column in adf table.
    We can retrieve the current row in the backing bean like
    ViewObject view = getViewObject();
    view.getCurrentRow();
    Is it possible to retrieve selected column id or column header text as we are getting for row?
    please give some sample.
    Thanks,
    Vijay.
    Edited by: Vijayakumar Palanisamy on Jun 23, 2011 2:23 AM

    Hi John
    My exact requirement,
    1.     We have collection of records in adf table
    2.     Each cell in the row has commandImageLink (Like adding approver, edit approver, delete etc)
    Currently it’s working fine for me in the commandImageLink listener, but the problem is table is refreshed 2 time,
    while selecting a record and commandImageLink is clicked, I have to avoid 2 times refreshing,
    If it’s possible to identify a particular cell in the row selection, I can avoid the image link listener.
    we are using Jdeveloper11.1.1.4.0
    Please suggest.
    Thanks,
    Vijay

  • How to validate cells of selected rows in editable ALV

    Hi,
    I have created an ALV grid which is editable. Now I have entered the values in the grid, and selected some rows for which I need to validate the cells. But this is not happening. It is validating all the cells edited in the grid.
    Can anyone help me...
    Regards,
    Satish Kanteti.

    Hi Satish,
    Follow below steps,
    1. Declare a additional field for selection flag in your internal table like below,
    DATA: BEGIN OF g_t_vekp OCCURS 0,
          flag(1) TYPE c,             "  <------   Flag for selection
          venum TYPE vekp-venum,
          exidv TYPE vekp-exidv,
          vbeln_gen TYPE vekp-vbeln_gen,
          END OF g_t_vekp.
    2.  Add extra  parameter  'i_callback_user_command'  in FM 'REUSE_ALV_GRID_DISPLAY'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = g_r_repid
          i_callback_user_command = 'USER_COMMAND'         "   <------  Additional parameter
          is_layout               = g_wa_layout
          it_fieldcat             = g_t_fieldcat[]
        TABLES
          t_outtab                = g_t_vekp
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    3. Define a form 'USER_COMMAND'  like below  to  check or save only selected  rows.
    FORM user_command USING l_r_ucomm LIKE sy-ucomm l_r_selfield TYPE slis_selfield.
      CASE l_r_ucomm.
    *Updating database when 'Save' is pressed
        WHEN '&DATA_SAVE'.
          LOOP AT g_t_vekp INTO g_wa_vekp WHERE flag = 'X'.    "   <----   Loop through only  selected rows
          "  Ur  operation on  selected  records
          ENDLOOP.
      ENDCASE.
      l_r_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    Might solve ur problem.
    Thanks,
    Edited by: Sap Fan on Oct 13, 2009 5:10 PM

  • Selected rows sequence in ALV

    Dear Fnds,
    My requirement is, Iam displaying output data in ALV. in the output ALV i have 10 rows.
    in the 10 rows if i select 5 rows(any rows), Example 3,7,1,2,5, Do we have any function module or class to determine the selected row sequence (which one we have selected as first, second and thrid etc.)

    srinu reddy wrote:
    Dear Fnds,
    >
    > My requirement is, Iam displaying output data in ALV. in the output ALV i have 10 rows.
    >
    > in the 10 rows if i select 5 rows(any rows), Example 3,7,1,2,5, Do we have any function module or class to determine the selected row sequence (which one we have selected as first, second and thrid etc.)
    Hi,
    I think you can achieve this thru GET CURSOR statement which will tell you current cursor position. I don`t think you can store it in a internal table to know the sequence.
    Try, have a look at this document. http://help.sap.com/saphelp_470/helpdata/en/9f/dbabf135c111d1829f0000e829fbfe/content.htm
    Hope, you find this useful.
    Reetesh

Maybe you are looking for

  • IPhone Outlook calendar synch issue

    My new iPhone does synch with my Outlook 2007 calendar, but only some, not all, of the calendar items actually are copied over to the phone. When I create an event on the phone, it does synch back to the computer. Any idea what's happening here?

  • Songs out of order even after editing the info

    Hello, Just recently out of the blue I noticed that some of the songs in my library were not in the correct order as they appear on the album. I went under "Get Info" to make sure that the track listing was correct (i.e. Track 2 of 10) and everything

  • How to use a link button in a matrix

    Hi, I'm trying to create a matrix with a column that uses a link button to call a Sales order.. how can i do it? i'm new in SBO!

  • SROAUG meeting invite-Friday June 21, 2002

    SROAUG Meeting Invite-Friday, June 21,2002 Please attend the SROAUG (Southwest Oracle Applications Users Group) upcoming meeting: Location: Sheraton Gateway Hotel at LAX (Los Angeles International Airport) Time: 8:30 am to 12:30 pm General Presentati

  • Bell character (^G or "\a") not producing audible beep

    The subject says it all. Well, almost all. I wanted irssi (I'm using it in conjunction with bitlbee) to beep audibly, but all I was getting was a visual bell. That was in GNU screen, but I tried 'echo ^G' in screen, a plain xterm, and vc/1 directly b