Using row selection in ALV using class cl_salv

Hi,
how to use row selection by using cl_salv classes...
I need to display scarr table in the basic list in ALV wthout using screens and function modules...
On multiple selection of carrid from ALV, need to display flight details from sflight.
Also how to get the selection buttons for corresponding rows.
NOTE : Using class cl_salv*
Thanks,
Siddarth

You may need to look into Rich's example code by the following thread
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01

Similar Messages

  • Detect rows selection in ALV using oops

    Hi ALL,
    I HAVE An ALV OUTPUT OF RECORDS USING OOPS.
    NOW I CAN SELECT ONE OR MULTIPLE ROWS OF THE OUTPUT AND I HAVE ADDED A DELETE ICON TO MY TOOL BAR.
    I HAVE BACK AND EXIT BUTTON AND I HAVE CODE FOR THE SAME IN PAI.
    FOR DELETE ICON SY-UCOMM IS DELE AND CONTROL COMES TO PAI
    MY QUESTION IS HOW DO YOU KNOW WHICH ROW OR ROWS ARE SELETEd , IN NORMAL ABAP , a field BOX type c has a value X , but what about in ALV using OOPS.
    I have no idea whether my approach is correct or wrong or do i need to something else.
    Thanks

    Hi Darren,
    This is what i have . Iam new oops so i want to just make sure
    method handle_user_command.
    § 3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
        data: lt_rows type lvc_t_row.
        case e_ucomm.
          when 'DELETE'.
            call method g_grid->get_selected_rows
                     importing et_index_rows = lt_rows.
    DATA : WA_LT_ROWS LIKE LINE OF LT_ROWS.
    LOOP AT LT_ROWS INTO WA_LT_ROWS.
    DELETE I_ZFINAL INDEX WA_LT_ROWS-INDEX.
    ENDLOOP.
    ENDCASE.
    call method g_grid->set_table_for_first_display
    exporting
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
         is_layout                     = g_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
        it_toolbar_excluding          = pt_exclude
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
      changing
        it_outtab                     =  i_zFINAL
        it_fieldcatalog               = fieldcat
       IT_SORT                       =
       IT_FILTER                     =
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4
    LET ME KNOW THANKS

  • Row Selection in ALV Grid created using CL_GUI_ALV_GRID

    Hi,
    I have ALV grid using cl_gui_alv_grid. I want to capture the row selection and display the selected rows in 2nd ALV grid (using cl_gui_alv_grid).
    Method CALL METHOD Grid->get_selected_rows giving right no. of selected records first time and process these records by POST button and hence shows these records in next alv grid. but when i came back to 1st ALV by pressing BACK button on 2nd ALV then if I again select records on the same 1st ALV grid the same Method CALL METHOD Grid->get_selected_rows fires again. but this times it wouldn't give the selected records. I mean first time this gives me correct no. of selected records but 2nd time wouldn't.
    how do I capture the row selection.?
    Kindly suggest me. helpful answer will be appreciated.
    Thanx in Advance.
    Robin

    Hi,
    Write this code, you have to free the container.
    MODULE user_command_0101 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
           c_container->free( ).
           c_container1->free( ). " this is the container of secondary list.
           clear: r_grid,  r_grid1, c_container, c_container1.
          LEAVE TO SCREEN 100.
      ENDCASE.
    Regards and Best wishes.

  • Using Row Selection in Analysis Web Item & Filter Command

    In the 7.0 WAD (Web Application Designer), I have two analysis items that both have different data providers, DP_1 & DP_2. The two data providers are views from the same query.
    In the properties of the first analysis item (DP_1), I'm using the Row Selection - 'Single with Commands', and I want to have a command that will filter on the value of the characteristic in the row selected and transfer that filter to the second analysis itme (DP_2). Is this possible?

    yes, you can do this. There is XHTML code:
    <bi:SET_SELECTION_STATE_BY_BINDING xmlns:bi="http://xml.sap.com/2005/01/bi/wad/bisp">
      <bi:TARGET_DATA_PROVIDER_REF_LIST type="ORDEREDLIST">
    // target data_provider:
        <bi:TARGET_DATA_PROVIDER_REF index="1" value="DP_2">
        </bi:TARGET_DATA_PROVIDER_REF>
      </bi:TARGET_DATA_PROVIDER_REF_LIST>
      <bi:SELECTION_BINDINGS type="UNORDEREDLIST">
        <bi:SELECTION_BINDING type="COMPOSITE" index="1">
    // target infoobject
          <bi:CHARACTERISTIC value="0DOC_ITEM__0VENDOR" text="0DOC_ITEM__0VENDOR">
          </bi:CHARACTERISTIC>
    // selection type
          <bi:SELECTION_BINDING_TYPE type="CHOICE" value="ITEM_CHARACTERISTIC">
            <bi:ITEM_CHARACTERISTIC type="COMPOSITE">
    // source analysis table
              <bi:ITEM_REF value="ANALYSIS_ITEM_1">
              </bi:ITEM_REF>
    // source infoobject
              <bi:CHARACTERISTIC value="0DOC_ITEM__0VENDOR" text="0DOC_ITEM__0VENDOR">
              </bi:CHARACTERISTIC>
            </bi:ITEM_CHARACTERISTIC>
          </bi:SELECTION_BINDING_TYPE>
        </bi:SELECTION_BINDING>
      </bi:SELECTION_BINDINGS>
    </bi:SET_SELECTION_STATE_BY_BINDING>
    Or you can do this using command wizard! good luck!

  • Row Select in ALV

    I have an alv that displays data from a few tables.
    If I select a row from teh ALV, then the following screen should display some of the fields of the row along with additional information..
    I understand that the ON_CLICK event should be used once the row is selected..However,  I would appreciate it if someone gave me more info on the same..
    Thanks!

    Hi,
    Tray this:
    <i>  DATA: lr_table  TYPE REF TO cl_salv_wd_table_lead_select,
                   lr_node  TYPE REF TO if_wd_context_node,
                   lv_field1 TYPE (field1 of your alv table ).
      lr_table ?= r_param.
      lr_node ?= wd_context->get_child_node( 'NODE_TABLE' ).
      CALL METHOD lr_node->get_attribute
        EXPORTING
          index = lr_table->IF_SALV_WD_TABLE_LEAD_SELECT~INDEX
          name  = 'FIELD1'
        IMPORTING
          value = lv_field1.
      </i>
    With this code, you will have the value of the field 1 of the selected row.

  • Row Selection in ALV on Single click

    Hi
    Can we read the row in ALV on row selection ?  i set  gs_layout-sel_mode = 'D'.
    My Scenario is as under
    there is an ALV on the screen in which i have displayed the data . there is a push button on the screen. User will select the row and then click the push button. on click of that push button selected row should move to the work area.
    I am using  following method
    CALL METHOD g_Grid->SET_TABLE_FOR_FIRST_DISPLAY
    Regards
    Ammad

    If the method [g_grid->get_selected_rows|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b55312d30911d2b467006094192fe3/frameset.htm] returns no row, then try a [g_grid->get_current_cell|http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b552fad30911d2b467006094192fe3/frameset.htm]  (Don't forget the [cl_gui_cfw=>flush|http://help.sap.com/saphelp_erp2004/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/frameset.htm] to synchronize the automation queue.)
    Regards,
    Raymond

  • Single row select in ALV Grid

    HI,
    I want to make my ALV Grid only single row select enabled, can some one guide me which variable should be set for the same.
    Thanks and Regards,
    Harsh

    If you are using OO for alv then
      call method grid1->get_selected_rows
        importing
          et_index_rows = i_sel_alvrows[].
      call method cl_gui_cfw=>flush.
      describe table i_sel_alvrows lines v_dbcnt.
      if i_sel_alvrows[] is initial.
    * Info message : Please select a row
        message i176.                        " Please select a row'.
      endif.
      if v_dbcnt gt 1.
    * Info message : Multiple Row Selection not  possible
        message i177.                        " Multiple Row Selection not
        " possible'
      endif.
    or if your using REUSE then
    form user_command using p_ucomm type sy-ucomm
                         rs_selfield type  slis_selfield.
    " Check the rs_selfield-tabindex value here
    " you may get some clue here
    endform.

  • Multiple Row Select in ALV

    Hi All.
    I am trying to set multiple selection on in ALV using the method SET_SELECTION_MODE of IF_WD_SELECT_OPTIONS.  (if_salv_wd_table_settings)
    But it is always resulting in a dump saying that :
    Selection type Multi is not allowed in combination with the selection Single of the data node
    Now how can we change the context of the ALV?
    What am i doing wrong here?
    Thanks.

    Hi this works fine here:
    data: lr_table_settings type ref to if_salv_wd_table_settings.
    lr_table_settings->set_read_only( abap_false ).
    lr_table_settings->set_enabled( abap_true ).
    lr_table_settings->set_selection_mode( CL_WD_TABLE=>e_selection_mode-multi ).
    The node i bound to the ALV has selection 0..n.
    Cheers,
    Sascha

  • How to set only one row selection  in ALV GRID DISPLAY

    How to set single row selection in grid display
    not multiselection.

    Hi,
    In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL  = 'X'.
    If more than single entry found, then raise an error message.
    Best regards,
    Prashant

  • Multiple Row selection in JSP using checkbox - Oracle BPM 10gR3

    Dear BPM Experts,
    Has anyone invoked JSP from Oracle BPM 10gR3 screen flow that has the following UI requirement.
    1. When UI is loaded user is presented with multiple rows of pre-populated data(each column of the row represents attributes of a BPM object) with checkbox against each of the rows for user to select one, many and all rows.
    2. User has option to select one, many and all rows and submit the form.
    3. Upon submission, the all data related to selected rows only should made available to a BPM process(either using Global Creation or Global Interactive activity)
    I was able to have the JSP created with FTL tags but unable to transmit the data back to BPM process. Same has been accomplished using BPM Presentation. Can any one please help me with the JSP implementation? It is little urgent, so your early intervention is much solicited and coveted.
    I will send you guys the code I have in case you need to review.
    Regards,
    Subho

    Hi friends
    I need to do the same feature, select elements, but in a tree object. I've followed the same approach - using a selectBooleanCheckBox in each node of the Tree. But, when I submit the page, the boolean property of my TreeNode object isnt changed.
    An Idea?
    thanks a lot!

  • How to capture row selection in ALV output List

    Hi experts,
    I am displaying some output using ALV function module. My requirement is i have to capture how much rows user has selected in the output list, based on this information i have to perform some actions.
    Please help me
    Regards,
    Sachin

    Hi Sachin,
    For this first you have to define a variable in your internal table of type c with length 1 and then while building the layout of the ALV, you have to pass this variable name to the layout field BOX_FIELDNAME.
    Now when you select a particular row, then the corresponding field in your internal table willl be marked with X. So, for further processing, you can just loop through the table where 'BOX = 'X' and proceed.
    For Example:
    *      Structure for output details
    TYPES: BEGIN OF gs_output.
            INCLUDE STRUCTURE zas_water_qlty_rep.
    TYPES: selected(1) TYPE c,
           END OF gs_output.
    DATA: object_tab            TYPE STANDARD TABLE OF gs_output.
    CONSTANTS: lc_selected(8)             TYPE c VALUE 'SELECTED'.
    lw_layout-box_fieldname     =   lc_selected.    "Field for checkbox
    * Local workarea
      DATA: lw_layout  TYPE slis_layout_alv.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_buffer_active          = gc_x
                i_bypassing_buffer       = gc_x
                i_callback_program       = lv_repid
                i_callback_pf_status_set = g_form_set_pf_stat
                i_callback_user_command  = lc_uform
                i_structure_name         = lv_zas_water_qlty_rep
                is_layout                = lw_layout
                it_fieldcat              = g_fieldcat_tab[]
                it_events                = g_events_tab[]
                it_event_exit            = g_event_exit_tab[]
           TABLES
                t_outtab                 = p_object_tab
           EXCEPTIONS
                program_error            = 1
                OTHERS                   = 2.
    Hope this helps.
    Regards,
    Phani.

  • Choose Row Selected on ALV

    Hi
    I have a requirement in FM ALV where I have a search box and the user can search for criteria. I then search my underlying data table and if the data is found I want to put the row focus on the particular row. How do I set row focus in FM ALV?
    Example:
    User searches for PERNR 778.
    778 is found at SY-TABIX 440. I now want the ALV to focus on row 440.

    Hi Brad,
    Try this way. It works. I have developed sample program for you. Change your program accordingly.
    <pre>REPORT  zvenkat_alv_list.
    DATA: BEGIN OF i_mard OCCURS 0,
           color(3) TYPE c,  "color
           werks TYPE mard-werks,
           lgort TYPE mard-lgort,
           matnr TYPE mard-matnr,
           insme TYPE mard-insme,
           einme TYPE mard-einme,
           speme TYPE mard-speme,
          END OF i_mard.
    Types Pools
    TYPE-POOLS:
       slis.
    Types
    TYPES:
       t_fieldcat         TYPE slis_fieldcat_alv,
       t_events           TYPE slis_alv_event,
       t_layout           TYPE slis_layout_alv.
    Workareas
    DATA:
       w_fieldcat         TYPE t_fieldcat,
       w_events           TYPE t_events,
       w_layout           TYPE t_layout.
    Internal Tables
    DATA:
       i_fieldcat         TYPE STANDARD TABLE OF t_fieldcat,
       i_events           TYPE STANDARD TABLE OF t_events.
    START-OF-SELECTION.
      PERFORM get_data_from_database .
      PERFORM build_fieldcatalog.
      w_layout-info_fieldname = 'COLOR'. "color
      PERFORM display_data.
    *&      Form  get_data_from_database
    FORM get_data_from_database .
      CLEAR :i_mard,i_mard[].
      SELECT werks lgort matnr insme einme speme
      FROM mard
      INTO CORRESPONDING FIELDS OF TABLE i_mard
        UP TO 100 ROWS.
    ENDFORM.                    " get_data_from_database
    *&      Form  build_fieldcatalog
    FORM build_fieldcatalog .
      CLEAR :w_fieldcat,i_fieldcat[].
      PERFORM build_fcat USING:
            "Field   Int Tab  Text
            'WERKS' 'I_MARD' 'WERKS',
            'LGORT' 'I_MARD' 'LGORT',
            'MATNR' 'I_MARD' 'MATNR',
            'INSME' 'I_MARD' 'INSME',
            'EINME' 'I_MARD' 'EINME',
            'SPEME' 'I_MARD' 'SPEME'.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  display_data
    FORM display_data .
      DATA :program LIKE sy-repid VALUE sy-repid.
      SORT i_mard BY werks.
      DELETE ADJACENT DUPLICATES FROM i_mard COMPARING werks.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = program
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = w_layout
          it_fieldcat             = i_fieldcat
          it_events               = i_events
        TABLES
          t_outtab                = i_mard.
    ENDFORM.                    " display_data
    *&      Form  BUILD_FCAT
    FORM build_fcat  USING  l_field l_tab l_text.
      w_fieldcat-fieldname = l_field.
      w_fieldcat-tabname   = l_tab.
      w_fieldcat-seltext_m = l_text.
      IF l_field = 'WERKS'.
        w_fieldcat-hotspot = 'X'.
      ENDIF.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
      IF r_ucomm = '&IC1'.
        READ TABLE i_mard WITH KEY werks = rs_selfield-value.
        IF sy-subrc = 0.
          i_mard-color = 'C31'.
          MODIFY i_mard INDEX sy-tabix.
        ENDIF.
        rs_selfield-refresh = 'X'.
      ENDIF.
    ENDFORM.                    "USER_COMMAND</pre>
    Thanks
    venkat.O

  • Default row selected in alv grid

    Hi Everyone,
    I have couple of alv screens. By default the topmost cell is highlighted in the first grid, the data of second grid is dependant on the first one. So if the topmost record is selected by default in first grid, i want to highlight its corresponding records in the second grid.
    How do I achieve this.
    Any help on this will be of great use to me.
    Thanks in advance,
    Prashant.

    In PAI,
    MODULE user_command_9001 INPUT.
      REFRESH i_fieldrows.
    <b>CALL METHOD o_alvgrid->get_selected_rows
                  IMPORTING
                  et_index_rows = i_fieldrows.</b>  LOOP AT i_fieldrows INTO w_fieldrows.
        READ TABLE i_output INTO w_output INDEX w_fieldrows-index.
      ENDLOOP.
      CASE sy-ucomm.
        WHEN 'EXIT' OR  'CANC'.
    WHEN 'MD04'.
          IF w_output-matnr IS INITIAL.
            MESSAGE i001 WITH text-e07.
          ELSE.
            SET PARAMETER ID 'MAT' FIELD w_output-matnr.
            SET PARAMETER ID 'WRK' FIELD w_output-werks.
            CALL TRANSACTION 'md04' AND SKIP FIRST SCREEN .
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    Similarly in the next screen PAI,
    use
    CALL METHOD o_alvgrid->set_selected_rows
                  IMPORTING
                  et_index_rows = i_fieldrows.

  • Default row select in ALV

    Hi ,
    Have a requirement where in all the rows in ALV should be selected defaultly.
    Thanks.
    Regards,
    Suvarna

    Hi suvarna,
    just add ,
    wa_layout-sel_mode    = c_a.
    this to ur ALV layout.
    u will get default selection mode.
    here c_a is 'A'.
    Regards,
    kk.

  • Reg..ALV using classes

    i have displayed a ALV report with a push button 'HST'.
    When i select a particular line(vbeln) and click on pushbutton 'HST' it has to display me a interactive report based on the condition vbeln and posnr.
    can anyone help me with the detail code using classes..
    answers will be rewarded....
    regards,
    kumar

    Hi,
    Class ALV Specification
    Classes used:
    CL_GUI_ALV_GRID
    Example of ALV using Classes
    DATA: lcl_alv TYPE REF TO cl_gui_alv_grid,
          t_flights TYPE STANDARD TABLE OF FLIGHTS.
    SELECT * FROM flights INTO TABLE t_flights.
    CREATE OBJECT lcl_alv
        EXPORTING I_PARENT = cl_gui_container=>screen0.
    CALL METHOD lcl_alv->set_table_for_first_display
        EXPORTING
           I_STRUCTURE_NAME = 'FLIGHTS'
        CHANGING
           IT_OUTTAB = t_flights.
    CALL SCREEN 100.
    Example Details
    This is a simple example of the class ALV, we do not need to create, in this case, a field catalog because we are using the whole table of FLIGHTS and we will show all the fields that this table contains, we do this at the I_STRUCTURE_NAME = 'FLIGHTS' statement.
    The CL_GUI_ALV_GRID constructor needs the I_PARENT parameter to define where it will be show, in the example we set the entire screen to place the ALV.
    reward if helpful

Maybe you are looking for

  • Error for faulty schedule items in PO with message no.MEPO001

    HI, We made some Purchase requisition and created one PO with respect to these PR then we deleted all item in PO( because created in wrong order type) and trying to create PO again with other order type and with same existing PR but sustem giving err

  • Tables where Work Center defined in Trx. IR02 are stored !

    Hi , I'm new to Work center , In IR02 , I can change a work center description, etc , .... In which SAP table(s) the work center and work center description will be stored . Thank you . Regard's

  • My Ipod touch 2nd generation won't upgrade to version 4.2.1 from 2.2.1.!!! Please help!!!

    It is definitely a 2nd generation.  I purchased it second hand and it must have been restored to factory defaults.  I plug it into Itunes and it says I have the latest version.  Where do I find 4.2.1???

  • Problem with delta on Business Partner on CRM

    Hi all!! I´m trying to send delta from Business Partners on CRM. I have activated the change pointers for the message type BUS1006, object BUPA_BUP and for table BUT000 on transaction BD52. When I create a new Business Partner an entry must be insert

  • Inserting Multimedia Links

    I have inserted multimedia links into my document. When I generate the links all work correctly. However, once I then move the file to the appropriate drive and then go click on the link I get an error message. The page cannot be found HTTP Error 404