<?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 Re: Selecting multiple rows in ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279758#M1388053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Try this way.&lt;/P&gt;&lt;P&gt;&amp;lt;font color=blue&amp;gt;&amp;lt;pre&amp;gt;&lt;/P&gt;&lt;P&gt; REPORT ztest_alv_row_selection.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF it_output OCCURS 0,&lt;/P&gt;&lt;P&gt;        select TYPE c,          &amp;lt;font color=red&amp;gt;"This variable stores the value when row selected.&amp;lt;/font&amp;gt;&lt;/P&gt;&lt;P&gt;        bukrs  TYPE t001-bukrs,&lt;/P&gt;&lt;P&gt;        butxt  TYPE t001-butxt,&lt;/P&gt;&lt;P&gt;      END OF it_output.&lt;/P&gt;&lt;P&gt;TYPE-POOLS:slis.&lt;/P&gt;&lt;P&gt;DATA:it_events            TYPE STANDARD TABLE OF slis_alv_event,&lt;/P&gt;&lt;P&gt;     it_fieldcat          TYPE STANDARD TABLE OF slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;     wa_fieldcat          TYPE slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;     wa_events            TYPE slis_alv_event,&lt;/P&gt;&lt;P&gt;     wa_layout            TYPE slis_layout_alv.&lt;/P&gt;&lt;P&gt;DATA:g_program            TYPE sy-repid VALUE sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_output UP TO 100 ROWS.&lt;/P&gt;&lt;P&gt;  DEFINE fieldcatalog.&lt;/P&gt;&lt;P&gt;    wa_fieldcat-fieldname = &amp;amp;1.&lt;/P&gt;&lt;P&gt;    wa_fieldcat-tabname   = &amp;amp;2.&lt;/P&gt;&lt;P&gt;    wa_fieldcat-seltext_l = &amp;amp;3.&lt;/P&gt;&lt;P&gt;    append wa_fieldcat to it_fieldcat.&lt;/P&gt;&lt;P&gt;    clear  wa_fieldcat.&lt;/P&gt;&lt;P&gt;  END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;  fieldcatalog: "Column table       col text&lt;/P&gt;&lt;P&gt;                'BUKRS' 'IT_OUTPUT' 'BUKRS',&lt;/P&gt;&lt;P&gt;                'BUTXT' 'IT_OUTPUT' 'BUTXT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_layout-box_fieldname     = 'SELECT'. &amp;lt;font color=red&amp;gt; "This has to be set to get selection&amp;lt;/font&amp;gt;&lt;/P&gt;&lt;P&gt;  wa_layout-colwidth_optimize = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_events-name              = 'PF_STATUS_SET'.&lt;/P&gt;&lt;P&gt;  wa_events-form              = 'PF_STATUS_SET'.&lt;/P&gt;&lt;P&gt;  APPEND wa_events TO it_events.&lt;/P&gt;&lt;P&gt;  CLEAR wa_events.&lt;/P&gt;&lt;P&gt;  wa_events-name              = 'USER_COMMAND'.&lt;/P&gt;&lt;P&gt;  wa_events-form              = 'USER_COMMAND'.&lt;/P&gt;&lt;P&gt;  APPEND wa_events TO it_events.&lt;/P&gt;&lt;P&gt;  CLEAR wa_events.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_callback_program = g_program&lt;/P&gt;&lt;P&gt;      is_layout          = wa_layout&lt;/P&gt;&lt;P&gt;      it_fieldcat        = it_fieldcat&lt;/P&gt;&lt;P&gt;      it_events          = it_events&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      t_outtab           = it_output.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  PF_STATUS_SET&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM pf_status_set USING rt_extab TYPE slis_t_extab.&lt;/P&gt;&lt;P&gt;  SET PF-STATUS 'ZTEST'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;1. When you set Pf status ZTEST, standard application tools will be removed.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;2. Goto SE41 give program 'SAPLKKBL' and status 'STANDARD_FULLSCREEN'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;3. Copy the status from those to ZTEST of our program. Now you will see all standard functions.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDFORM.                    "PF_STATUS_SET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FORM USER_COMMAND                                          *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check function code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CASE r_ucomm.&lt;/P&gt;&lt;P&gt;    WHEN 'DISPLAY'.  "user presses SAVE&lt;/P&gt;&lt;P&gt;      LOOP AT it_output.&lt;/P&gt;&lt;P&gt;        IF it_output-select EQ 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Process records that have been selected&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          WRITE:/ it_output.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt;ENDFORM.                    "user_command&amp;lt;/pre&amp;gt;&amp;lt;/font&amp;gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Oct 2009 10:54:39 GMT</pubDate>
    <dc:creator>venkat_o</dc:creator>
    <dc:date>2009-10-28T10:54:39Z</dc:date>
    <item>
      <title>Selecting multiple rows in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279756#M1388051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I am using REUSE_ALV_GRID_DISPLAY FM in my program for my ALV output . I need to select multiple rows and will click a custom button on the appln toolbar. How can I know which all rows are selected? Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;Neeraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2009 10:10:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279756#M1388051</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-28T10:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple rows in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279757#M1388052</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;In the  ALV layout use the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gs_layout-box_fieldname = 'SEL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and pass gs_layout to the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your internal table declare another extra field SEL of type C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the user selects a row, 'X' would be saved in the SEL field of the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Harini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2009 10:16:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279757#M1388052</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-28T10:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple rows in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279758#M1388053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Try this way.&lt;/P&gt;&lt;P&gt;&amp;lt;font color=blue&amp;gt;&amp;lt;pre&amp;gt;&lt;/P&gt;&lt;P&gt; REPORT ztest_alv_row_selection.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF it_output OCCURS 0,&lt;/P&gt;&lt;P&gt;        select TYPE c,          &amp;lt;font color=red&amp;gt;"This variable stores the value when row selected.&amp;lt;/font&amp;gt;&lt;/P&gt;&lt;P&gt;        bukrs  TYPE t001-bukrs,&lt;/P&gt;&lt;P&gt;        butxt  TYPE t001-butxt,&lt;/P&gt;&lt;P&gt;      END OF it_output.&lt;/P&gt;&lt;P&gt;TYPE-POOLS:slis.&lt;/P&gt;&lt;P&gt;DATA:it_events            TYPE STANDARD TABLE OF slis_alv_event,&lt;/P&gt;&lt;P&gt;     it_fieldcat          TYPE STANDARD TABLE OF slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;     wa_fieldcat          TYPE slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;     wa_events            TYPE slis_alv_event,&lt;/P&gt;&lt;P&gt;     wa_layout            TYPE slis_layout_alv.&lt;/P&gt;&lt;P&gt;DATA:g_program            TYPE sy-repid VALUE sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_output UP TO 100 ROWS.&lt;/P&gt;&lt;P&gt;  DEFINE fieldcatalog.&lt;/P&gt;&lt;P&gt;    wa_fieldcat-fieldname = &amp;amp;1.&lt;/P&gt;&lt;P&gt;    wa_fieldcat-tabname   = &amp;amp;2.&lt;/P&gt;&lt;P&gt;    wa_fieldcat-seltext_l = &amp;amp;3.&lt;/P&gt;&lt;P&gt;    append wa_fieldcat to it_fieldcat.&lt;/P&gt;&lt;P&gt;    clear  wa_fieldcat.&lt;/P&gt;&lt;P&gt;  END-OF-DEFINITION.&lt;/P&gt;&lt;P&gt;  fieldcatalog: "Column table       col text&lt;/P&gt;&lt;P&gt;                'BUKRS' 'IT_OUTPUT' 'BUKRS',&lt;/P&gt;&lt;P&gt;                'BUTXT' 'IT_OUTPUT' 'BUTXT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_layout-box_fieldname     = 'SELECT'. &amp;lt;font color=red&amp;gt; "This has to be set to get selection&amp;lt;/font&amp;gt;&lt;/P&gt;&lt;P&gt;  wa_layout-colwidth_optimize = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_events-name              = 'PF_STATUS_SET'.&lt;/P&gt;&lt;P&gt;  wa_events-form              = 'PF_STATUS_SET'.&lt;/P&gt;&lt;P&gt;  APPEND wa_events TO it_events.&lt;/P&gt;&lt;P&gt;  CLEAR wa_events.&lt;/P&gt;&lt;P&gt;  wa_events-name              = 'USER_COMMAND'.&lt;/P&gt;&lt;P&gt;  wa_events-form              = 'USER_COMMAND'.&lt;/P&gt;&lt;P&gt;  APPEND wa_events TO it_events.&lt;/P&gt;&lt;P&gt;  CLEAR wa_events.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      i_callback_program = g_program&lt;/P&gt;&lt;P&gt;      is_layout          = wa_layout&lt;/P&gt;&lt;P&gt;      it_fieldcat        = it_fieldcat&lt;/P&gt;&lt;P&gt;      it_events          = it_events&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      t_outtab           = it_output.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  PF_STATUS_SET&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM pf_status_set USING rt_extab TYPE slis_t_extab.&lt;/P&gt;&lt;P&gt;  SET PF-STATUS 'ZTEST'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;1. When you set Pf status ZTEST, standard application tools will be removed.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;2. Goto SE41 give program 'SAPLKKBL' and status 'STANDARD_FULLSCREEN'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;3. Copy the status from those to ZTEST of our program. Now you will see all standard functions.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDFORM.                    "PF_STATUS_SET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FORM USER_COMMAND                                          *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check function code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CASE r_ucomm.&lt;/P&gt;&lt;P&gt;    WHEN 'DISPLAY'.  "user presses SAVE&lt;/P&gt;&lt;P&gt;      LOOP AT it_output.&lt;/P&gt;&lt;P&gt;        IF it_output-select EQ 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Process records that have been selected&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          WRITE:/ it_output.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt;ENDFORM.                    "user_command&amp;lt;/pre&amp;gt;&amp;lt;/font&amp;gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Venkat.O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2009 10:54:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279758#M1388053</guid>
      <dc:creator>venkat_o</dc:creator>
      <dc:date>2009-10-28T10:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting multiple rows in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279759#M1388054</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;There is no way ALV Functionality for multiple rows selection&lt;/P&gt;&lt;P&gt;except using &lt;STRONG&gt;CTRL&lt;/STRONG&gt; button, You can include Checkbox in the &lt;/P&gt;&lt;P&gt;ALV Output to select multiple rows simultaneously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to capture the how many number of rows&lt;/P&gt;&lt;P&gt;are selected from the ALV output, you can try using method using OOPS concept:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL METHOD gr_alvgrid-&amp;gt;get_selected_rows
IMPORTING
et_row_no = lt_selected_rows .

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want that in simple ALV output , then you have to remove the default box that comes there&lt;/P&gt;&lt;P&gt; and add checkbox to ur internal table, You can go through this link below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mansi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Oct 2009 11:14:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-multiple-rows-in-alv/m-p/6279759#M1388054</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-28T11:14:10Z</dc:date>
    </item>
  </channel>
</rss>

