<?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 ALV Grid select rows in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572600#M587558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ALV grid, IF I select a row and click the Change button... I have to prompt a customized screen which display the selected row values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;the screen should display as follows&lt;/P&gt;&lt;P&gt;Field1 12345&lt;/P&gt;&lt;P&gt;Field2 XXXX&lt;/P&gt;&lt;P&gt;Field3 hhhh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to get the selected row values and transfer it to the customized screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And If i change any of the values in the screen and click the save button, the values should be updated in the ALV grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to do this... kindly help...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jaffer Ali.S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2007 14:51:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-07T14:51:07Z</dc:date>
    <item>
      <title>ALV Grid select rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572600#M587558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the ALV grid, IF I select a row and click the Change button... I have to prompt a customized screen which display the selected row values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;the screen should display as follows&lt;/P&gt;&lt;P&gt;Field1 12345&lt;/P&gt;&lt;P&gt;Field2 XXXX&lt;/P&gt;&lt;P&gt;Field3 hhhh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to get the selected row values and transfer it to the customized screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And If i change any of the values in the screen and click the save button, the values should be updated in the ALV grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to do this... kindly help...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jaffer Ali.S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 14:51:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572600#M587558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T14:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid select rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572601#M587559</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;&lt;/P&gt;&lt;P&gt;   Create a Screen to display a record in edit mode.. in SE51 for the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   in ALV grid.. use USER_COMMAND and give the name of the subroutine for the interactive functionality..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  when 'CHNG'.  " remember you will have the complete selected line in the subroutine parameters when dealing with ALV.. &lt;/P&gt;&lt;P&gt;&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  USER_COMMAND&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 user_command using    p_ucomm    like sy-ucomm&lt;/P&gt;&lt;P&gt;                         p_selfield type slis_selfield.&lt;/P&gt;&lt;P&gt;  data : l_index like sy-index,&lt;/P&gt;&lt;P&gt;         l_refbn like cooi-refbn.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;  l_index = p_selfield-tabindex.       " holds the selected table index&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;  clear l_refbn.&lt;/P&gt;&lt;P&gt;  case p_ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    when 'CHG'.&lt;/P&gt;&lt;P&gt;      clear l_refbn.&lt;/P&gt;&lt;P&gt;      read table it_outtab index l_index.&lt;/P&gt;&lt;P&gt;      if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;       move-corresponding fileds to your screen fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       call screen &amp;lt;Your screen number&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;              else.&lt;/P&gt;&lt;P&gt;        message e999 with text-014.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;  endcase.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in the PAI of your screen say modity interntable with this detaisl..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Mahesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 15:08:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572601#M587559</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T15:08:44Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid select rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572602#M587560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaffer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz, check this sample code... &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;===============================================&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;class lcl_event_receiver definition.

  public section.
    class-methods:

    handle_toolbar
        for event toolbar of cl_gui_alv_grid
            importing e_object e_interactive,

    handle_user_command
        for event user_command of cl_gui_alv_grid
            importing e_ucomm.

  private section.

endclass.                    "lcl_event_receiver DEFINITION
===============================================
class lcl_event_receiver implementation.

  method handle_toolbar.

    data: ls_toolbar  type stb_button.

*....................................................................
* append a separator to normal toolbar
    clear ls_toolbar.
    move 3 to ls_toolbar-butn_type.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.

* append an icon
    clear ls_toolbar.
    move 'REFRESH' to ls_toolbar-function.
    move icon_refresh to ls_toolbar-icon.
    move 'Refresh' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.

* append a separator to normal toolbar
    clear ls_toolbar.
    move 3 to ls_toolbar-butn_type.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.

* append icons
    clear ls_toolbar.
    move 'SELTRAN' to ls_toolbar-function.
    move icon_select_block to ls_toolbar-icon.
    move 'Select only Red or Yellow' to ls_toolbar-text.
    move ' ' to ls_toolbar-disabled.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.

    clear ls_toolbar.
    move 'TRANS' to ls_toolbar-function.
    move icon_copy_object to ls_toolbar-icon.
    move 'Transfer only the selected orders' to ls_toolbar-text.
    move ' ' to ls_toolbar-disabled.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.

  endmethod.                    "handle_toolbar
*-------------------------------------------------------------------
  method handle_user_command.

   data: lt_row_no type lvc_t_roid.                                     &amp;lt;== (1)selected rows

    case e_ucomm.
      when 'REFRESH'.
        perform make_worder.
        perform read_mes_if_log.
        perform make_alv_worder.
        call method g_grid-&amp;gt;refresh_table_display.

      when 'SELTRAN'.
        perform select_red_yellow_rows.

      when 'TRANS'.                                                          &amp;lt;== if "change" button
        call method g_grid-&amp;gt;get_selected_rows              &amp;lt;==(2) look at this
          importing
            et_row_no = lt_row_no.

        call method cl_gui_cfw=&amp;gt;flush.

        call screen 2000.                                        &amp;lt;== (3) your customized screen

    endcase.

  endmethod.                           "handle_user_command

endclass.                    "lcl_event_receiver IMPLEMENTATION&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;===============================================&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 01:35:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572602#M587560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T01:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid select rows</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572603#M587561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its a little different using the class, First you need to set the selection module before calling the SET_TABLE_FOR_FIRST_DISPLAY method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:      LAYOUT  TYPE LVC_S_LAYO,&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; LAYOUT-SEL_MODE = 'D'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CALL METHOD ALV_GRID-&amp;gt;SET_TABLE_FOR_FIRST_DISPLAY&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;           IS_LAYOUT              = LAYOUT&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;           IT_OUTTAB       = IALV[]&lt;/P&gt;&lt;P&gt;           IT_FIELDCATALOG = FIELDCAT[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this will give you the selection box in the ALV output, then you use the method GET_SELECTED_ROWS to determine what rows the user has selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: INDEX_ROWS TYPE LVC_T_ROW,&lt;/P&gt;&lt;P&gt;      INDEX LIKE LINE OF INDEX_ROWS.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CLEAR INDEX_ROWS.  REFRESH INDEX_ROWS.&lt;/P&gt;&lt;P&gt;  CALL METHOD ALV_GRID-&amp;gt;GET_SELECTED_ROWS&lt;/P&gt;&lt;P&gt;           IMPORTING&lt;/P&gt;&lt;P&gt;                 ET_INDEX_ROWS = INDEX_ROWS.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Do something with those selected rows here&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      LOOP AT INDEX_ROWS INTO INDEX.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Use the index to read the specific line of ALV which is selected&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        READ TABLE IALV INDEX INDEX-INDEX.&lt;/P&gt;&lt;P&gt;        IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Now do what ever you need to with the selected line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2007 02:47:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-select-rows/m-p/2572603#M587561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-08T02:47:57Z</dc:date>
    </item>
  </channel>
</rss>

