<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic get_selected_rows returns nothing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423910#M1050623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use the ALV Object model. I've added the option for the user to select multiple rows (via set_selection_mode ROW_COLUMN). However, after the user has selected rows and pushes the continue button, I don't find any data with the method get_selected_rows. What could be causing this problem? I noticed that in the method get_selected_rows he doesn't get passed this statement:&lt;/P&gt;&lt;P&gt;if rows_rec = abap_false. &lt;/P&gt;&lt;P&gt;===&amp;gt; row_rec is 'X'....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your advice!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Sep 2008 20:18:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-02T20:18:57Z</dc:date>
    <item>
      <title>get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423910#M1050623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use the ALV Object model. I've added the option for the user to select multiple rows (via set_selection_mode ROW_COLUMN). However, after the user has selected rows and pushes the continue button, I don't find any data with the method get_selected_rows. What could be causing this problem? I noticed that in the method get_selected_rows he doesn't get passed this statement:&lt;/P&gt;&lt;P&gt;if rows_rec = abap_false. &lt;/P&gt;&lt;P&gt;===&amp;gt; row_rec is 'X'....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your advice!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2008 20:18:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423910#M1050623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-02T20:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423911#M1050624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is working fine for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check report: BCALV_EDIT_05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2008 20:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423911#M1050624</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2008-09-02T20:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423912#M1050625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this sample code of popup using ALV OM model with a checkbox to select rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF type_output,
         matnr TYPE matnr,
       END OF type_output.

DATA:lt_output   TYPE STANDARD TABLE OF type_output,
     lwa_rows    TYPE int4,
     lwa_output  TYPE type_output,
     lt_rows     TYPE salv_t_row.

* Local declarations.
DATA: lr_table      TYPE REF TO cl_salv_table,
      lr_selections TYPE REF TO cl_salv_selections.
DATA: lr_columns    TYPE REF TO cl_salv_columns_table.


START-OF-SELECTION.

* Prepare data.
  lwa_output-matnr = 'TEST1'.APPEND lwa_output TO lt_output.
  lwa_output-matnr = 'TEST2'.APPEND lwa_output TO lt_output.
  lwa_output-matnr = 'TEST3'.APPEND lwa_output TO lt_output.

* Call the factory method
  TRY.
      cl_salv_table=&amp;gt;factory(
        EXPORTING
          list_display = 'X'
        IMPORTING
          r_salv_table = lr_table
        CHANGING
          t_table      = lt_output ).
    CATCH cx_salv_msg.                                  "#EC NO_HANDLER

  ENDTRY.


* Popup
  lr_table-&amp;gt;set_screen_popup(
    start_column = 5
    end_column   = 90
    start_line   = 5
    end_line     = 15 ).


* Column selection
  lr_selections = lr_table-&amp;gt;get_selections( ).
  lr_selections-&amp;gt;set_selection_mode( if_salv_c_selection_mode=&amp;gt;row_column ).

  lr_columns = lr_table-&amp;gt;get_columns( ).
  lr_columns-&amp;gt;set_optimize( abap_true ).

* Display
  lr_table-&amp;gt;display( ).

* Get the selected rows.
  lt_rows = lr_selections-&amp;gt;get_selected_rows( ).

* Display the selected rows.
  LOOP AT lt_rows INTO lwa_rows.
    READ TABLE lt_output INTO lwa_output INDEX lwa_rows.

    WRITE: / lwa_output-matnr.

  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2008 20:49:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423912#M1050625</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-02T20:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423913#M1050626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the replies. I tried to use the code provided (and it works), but when I put my ALV in a container on my screen '0100' it doesn't work anymore. Do you need to provide extra parameters in order to be able to use selection from an ALV in a screen?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 06:00:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423913#M1050626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T06:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423914#M1050627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The list on the screen '0100' has the extra column to make multiple row selections, however in my process after input module the table remains empty when the user has selected 1 or more lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gr_rows = gr_selections-&amp;gt;get_selected_rows( ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 08:47:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423914#M1050627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T08:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423915#M1050628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are displaying the SALV in a container...Then call the method get_metadata...before calling the get_selected_rows..method..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: g_container TYPE scrfname VALUE 'CONTAINER1'.
DATA: g_custom_container TYPE REF TO cl_gui_custom_container.

TYPES: BEGIN OF type_output,
         matnr TYPE matnr,
       END OF type_output.

DATA:lt_output   TYPE STANDARD TABLE OF type_output,
     lwa_rows    TYPE int4,
     lwa_output  TYPE type_output,
     lt_rows     TYPE salv_t_row.

* Local declarations.
DATA: lr_table      TYPE REF TO cl_salv_table,
      lr_selections TYPE REF TO cl_salv_selections.
DATA: lr_columns    TYPE REF TO cl_salv_columns_table.
DATA: lr_grid       TYPE REF TO cl_gui_alv_grid.

START-OF-SELECTION.

* Prepare data.
  lwa_output-matnr = 'TEST1'.APPEND lwa_output TO lt_output.
  lwa_output-matnr = 'TEST2'.APPEND lwa_output TO lt_output.
  lwa_output-matnr = 'TEST3'.APPEND lwa_output TO lt_output.


  CALL SCREEN 100.

*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                                             *
*---------------------------------------------------------------------*
MODULE pbo OUTPUT.
  SET PF-STATUS 'TEST'.

  IF g_custom_container IS INITIAL.

    CREATE OBJECT g_custom_container
      EXPORTING
        container_name = g_container.

* Call the factory method
    TRY.
        cl_salv_table=&amp;gt;factory(
          EXPORTING
            r_container = g_custom_container
            container_name = 'CONTAINER1'
          IMPORTING
            r_salv_table = lr_table
          CHANGING
            t_table      = lt_output ).
      CATCH cx_salv_msg.                                "#EC NO_HANDLER

    ENDTRY.


* Column selection
    lr_selections = lr_table-&amp;gt;get_selections( ).
    lr_selections-&amp;gt;set_selection_mode( if_salv_c_selection_mode=&amp;gt;row_column ).

    lr_columns = lr_table-&amp;gt;get_columns( ).
    lr_columns-&amp;gt;set_optimize( abap_true ).

* Display
    lr_table-&amp;gt;display( ).


  ENDIF.
ENDMODULE.                    "pbo OUTPUT
*---------------------------------------------------------------------*
*       MODULE PAI INPUT                                              *
*---------------------------------------------------------------------*
MODULE pai INPUT.
  CASE sy-ucomm.
    WHEN 'EXIT' OR 'BACK'.
      PERFORM exit_program.

    WHEN 'GET_ROWS'.

      LEAVE TO LIST-PROCESSING.

      CALL METHOD lr_table-&amp;gt;get_metadata.  " call this method....

* Get the selected rows.
      lt_rows = lr_selections-&amp;gt;get_selected_rows( ).


* Display the selected rows.
      LOOP AT lt_rows INTO lwa_rows.
        READ TABLE lt_output INTO lwa_output INDEX lwa_rows.

        WRITE: / lwa_output-matnr.

      ENDLOOP.

  ENDCASE.
ENDMODULE.                    "pai INPUT
*---------------------------------------------------------------------*
*       FORM EXIT_PROGRAM                                             *
*---------------------------------------------------------------------*
FORM exit_program.
  LEAVE PROGRAM.
ENDFORM.                    "exit_program&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 16:39:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423915#M1050628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-03T16:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423916#M1050629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey, &lt;/P&gt;&lt;P&gt;i just wanted to say, that i had similar problem and the solution from Narendran Muthukumaran  worked perfect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greets, &lt;/P&gt;&lt;P&gt;Kuba&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Mar 2011 10:13:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423916#M1050629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-03-14T10:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423917#M1050630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Naimesh, nice demo program. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Sep 2013 21:13:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423917#M1050630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-09-22T21:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: get_selected_rows returns nothing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423918#M1050631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Mar 2016 03:56:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-selected-rows-returns-nothing/m-p/4423918#M1050631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-03-22T03:56:07Z</dc:date>
    </item>
  </channel>
</rss>

