<?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 problem with gt_grid in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943471#M389156</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am debugging through sap system code and i reached the following:&lt;/P&gt;&lt;P&gt;in form Marks_save there is an abap statement&lt;/P&gt;&lt;P&gt;call method gt_grid-grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but they did not define gt_grid anywhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the abap function that I am writing, I wrote the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data gt_grid type grid occurs 0 with header line.&lt;/P&gt;&lt;P&gt;data lt_rows type lvc_t_row.&lt;/P&gt;&lt;P&gt;call method gt_grid-grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;     importing et_index_rows = lt_rowd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I am compiling, the compiler is telling me gt_grid is not a structure and it does not have a component grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what seems to be the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically what i want to do is to get the selected rows from a grid, any ideas on how to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Feb 2007 23:33:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-08T23:33:54Z</dc:date>
    <item>
      <title>problem with gt_grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943471#M389156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am debugging through sap system code and i reached the following:&lt;/P&gt;&lt;P&gt;in form Marks_save there is an abap statement&lt;/P&gt;&lt;P&gt;call method gt_grid-grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but they did not define gt_grid anywhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the abap function that I am writing, I wrote the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data gt_grid type grid occurs 0 with header line.&lt;/P&gt;&lt;P&gt;data lt_rows type lvc_t_row.&lt;/P&gt;&lt;P&gt;call method gt_grid-grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;     importing et_index_rows = lt_rowd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I am compiling, the compiler is telling me gt_grid is not a structure and it does not have a component grid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what seems to be the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically what i want to do is to get the selected rows from a grid, any ideas on how to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 23:33:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943471#M389156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T23:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: problem with gt_grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943472#M389157</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;The get_selected_rows method is in the cl_gui_alv_grid object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to this sample code:&lt;/P&gt;&lt;P&gt;DATA: w_grid  TYPE REF TO cl_gui_alv_grid.&lt;/P&gt;&lt;P&gt;DATA ls_trows TYPE lvc_t_row.&lt;/P&gt;&lt;P&gt;DATA ls_row TYPE lvc_s_row.&lt;/P&gt;&lt;P&gt;DATA:lw_valid TYPE char1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD w_grid-&amp;gt;check_changed_data&lt;/P&gt;&lt;P&gt;          IMPORTING&lt;/P&gt;&lt;P&gt;             e_valid = lw_valid.&lt;/P&gt;&lt;P&gt;  IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;    "ignore&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  CALL METHOD w_grid-&amp;gt;refresh_table_display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;    "ignore&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD w_grid-&amp;gt;get_selected_rows&lt;/P&gt;&lt;P&gt;     IMPORTING&lt;/P&gt;&lt;P&gt;       et_index_rows = ls_trows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;    "ignore&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Award points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 02:05:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943472#M389157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T02:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: problem with gt_grid</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943473#M389158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Refer this code&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>Fri, 09 Feb 2007 03:33:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-gt-grid/m-p/1943473#M389158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T03:33:06Z</dc:date>
    </item>
  </channel>
</rss>

