<?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: GRID CONTROLLER in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922732#M383231</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Judith already showed you can retrieve the selected grid rows using method GET_SELECTED_ROWS. However, I would like to add a few remarks to her coding:&lt;/P&gt;&lt;P&gt;- If you need icons in your program do no longer use INCLUDE &amp;lt;icon&amp;gt;. but instead use&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS: icon.   " valid since release 6.20&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you simply want to get the selected grid rows at PAI of your dynpro then you do not need any event handling. Simply code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

...
        CALL METHOD o_alvgrid-&amp;gt;get_selected_rows
          IMPORTING
            et_index_rows = gt_selected_rows
*            ET_ROW_NO     =
            .

...

ENDMODULE.                 " USER_COMMAND_0100  INPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If you need to get the selected rows within an event handling method perhaps it is better to use the SENDER instance instead of the (globally) defined grid instance, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*   event receiver definitions for ALV actions
  PUBLIC SECTION.
    CLASS-METHODS:
*      user commands from grid toolbar
       handle_user_command
        FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING 
              e_ucomm
              sender.   " = grid instance that raised the event
...&lt;/CODE&gt;&lt;/PRE&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 IMPLEMENTATION.
  METHOD handle_user_command.
* In event handler method for event USER_COMMAND: Query your
*   function codes defined in step 2 and react accordingly.
...
        CALL METHOD sender-&amp;gt;get_selected_rows
          IMPORTING
            et_index_rows = gt_selected_rows
*            ET_ROW_NO     =
            .
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Feb 2007 03:59:43 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2007-02-09T03:59:43Z</dc:date>
    <item>
      <title>GRID CONTROLLER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922729#M383228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI TO ALL,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  HOW TO TRANSFER THE SELECTED ROWS FROM  THE ALV  GRID CONTAINER TO THE INTERNAL TABLE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLZ SEND SOME EXAMPLES TOO,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS IN ADVANCE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 12:22:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922729#M383228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T12:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: GRID CONTROLLER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922730#M383229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;data :   gi_index_rows TYPE lvc_t_row,&lt;/P&gt;&lt;P&gt;        g_selected_row LIKE lvc_s_row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH gi_index_rows.&lt;/P&gt;&lt;P&gt;  CLEAR   g_selected_row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD obj_grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      et_index_rows = gi_index_rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT gi_index_rows INTO g_selected_row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        READ TABLE itab INDEX g_selected_row-index INTO&lt;/P&gt;&lt;P&gt;      wa_itab.&lt;/P&gt;&lt;P&gt;                ..............&lt;/P&gt;&lt;P&gt;                ..............              " move all the fields wa_itab to jtab.&lt;/P&gt;&lt;P&gt;                ..............&lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;     ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 12:30:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922730#M383229</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T12:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: GRID CONTROLLER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922731#M383230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Refer this code sample&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
INCLUDE &amp;lt;icon&amp;gt;.
 
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.
CLASS lcl_event_receiver DEFINITION DEFERRED.
CLASS cl_gui_container DEFINITION LOAD.
 
DATA : o_alvgrid          TYPE REF TO cl_gui_alv_grid,
       o_dockingcontainer TYPE REF TO cl_gui_docking_container,
       o_eventreceiver    TYPE REF TO lcl_event_receiver.
CLASS lcl_event_receiver DEFINITION.
 
*   event receiver definitions for ALV actions
  PUBLIC SECTION.
    CLASS-METHODS:
* Status bar
       handle_user_command
        FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD handle_user_command.
* In event handler method for event USER_COMMAND: Query your
*   function codes defined in step 2 and react accordingly.
 
    CASE e_ucomm.
 
      WHEN 'FCODE'.
 
        CALL METHOD o_alvgrid-&amp;gt;get_selected_rows
          IMPORTING
            et_index_rows = i_selected_rows
*            ET_ROW_NO     =
            .
 
        IF i_selected_rows[] IS INITIAL.
          MESSAGE i153 WITH text-009.
          LEAVE LIST-PROCESSING.
        ENDIF.
 
        CLEAR: w_reviewed_mat.
 
*        w_reviewed_mat-reviewed = c_x.
*        w_reviewed_mat-reviewedby = sy-uname.
*        w_reviewed_mat-reviewedon = sy-datum.
 
        LOOP AT i_selected_rows INTO w_selected_rows.
          READ TABLE i_output INTO w_output INDEX w_selected_rows-index.
          IF sy-subrc EQ 0.
            w_reviewed_mat-matnr = w_output-matnr.
          ENDIF.
          APPEND w_reviewed_mat TO i_reviewed_mat.
          CLEAR: w_reviewed_mat-matnr.
        ENDLOOP.
 
*        MODIFY zzcs_mat FROM TABLE i_reviewed_mat.
 
      WHEN OTHERS.
 
    ENDCASE.
  ENDMETHOD.
 
In PBO after creating container 
SET HANDLER o_eventreceiver-&amp;gt;handle_user_command  FOR o_Alvgrid.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 12:56:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922731#M383230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T12:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: GRID CONTROLLER</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922732#M383231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ramesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As Judith already showed you can retrieve the selected grid rows using method GET_SELECTED_ROWS. However, I would like to add a few remarks to her coding:&lt;/P&gt;&lt;P&gt;- If you need icons in your program do no longer use INCLUDE &amp;lt;icon&amp;gt;. but instead use&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS: icon.   " valid since release 6.20&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you simply want to get the selected grid rows at PAI of your dynpro then you do not need any event handling. Simply code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

...
        CALL METHOD o_alvgrid-&amp;gt;get_selected_rows
          IMPORTING
            et_index_rows = gt_selected_rows
*            ET_ROW_NO     =
            .

...

ENDMODULE.                 " USER_COMMAND_0100  INPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If you need to get the selected rows within an event handling method perhaps it is better to use the SENDER instance instead of the (globally) defined grid instance, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*   event receiver definitions for ALV actions
  PUBLIC SECTION.
    CLASS-METHODS:
*      user commands from grid toolbar
       handle_user_command
        FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING 
              e_ucomm
              sender.   " = grid instance that raised the event
...&lt;/CODE&gt;&lt;/PRE&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 IMPLEMENTATION.
  METHOD handle_user_command.
* In event handler method for event USER_COMMAND: Query your
*   function codes defined in step 2 and react accordingly.
...
        CALL METHOD sender-&amp;gt;get_selected_rows
          IMPORTING
            et_index_rows = gt_selected_rows
*            ET_ROW_NO     =
            .
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 03:59:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/grid-controller/m-p/1922732#M383231</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-02-09T03:59:43Z</dc:date>
    </item>
  </channel>
</rss>

