<?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 OO - single handler for several grids in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436718#M1648155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi people!&lt;/P&gt;&lt;P&gt;                First of all, I apologize if this thread is not in the correct section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a screen which displays three ALV OO, and each one of these ALV have to respond to double click event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The functionality for the double click event is the same for all the ALVs, this is, to show another screen with detailed data based on each ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I know about OO programming( which is not too much btw...) in order to do this, I have to create a handler class for each one of these ALV (feel free to correct me if I'm wrong about this):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class handler_1 to manage grid_1 &lt;/P&gt;&lt;P&gt;class handler_2 to manage grid_2&lt;/P&gt;&lt;P&gt;class handler_3 to manage grid_3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this is not efficient at all, because the functionality of each handler is the same for all of the ALV's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's why I wanted to know if there's a way to get which of the ALV's is triggering the handle_double_click event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been searching, and I found this, but it's used for handle_data_changed event &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/sap-technical/abap/handling-changes-to-multiple-alv-grids" target="test_blank"&gt;http://www.erpgenie.com/sap-technical/abap/handling-changes-to-multiple-alv-grids&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jan 2012 17:39:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-01-04T17:39:20Z</dc:date>
    <item>
      <title>ALV OO - single handler for several grids</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436718#M1648155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi people!&lt;/P&gt;&lt;P&gt;                First of all, I apologize if this thread is not in the correct section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a screen which displays three ALV OO, and each one of these ALV have to respond to double click event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The functionality for the double click event is the same for all the ALVs, this is, to show another screen with detailed data based on each ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I know about OO programming( which is not too much btw...) in order to do this, I have to create a handler class for each one of these ALV (feel free to correct me if I'm wrong about this):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class handler_1 to manage grid_1 &lt;/P&gt;&lt;P&gt;class handler_2 to manage grid_2&lt;/P&gt;&lt;P&gt;class handler_3 to manage grid_3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this is not efficient at all, because the functionality of each handler is the same for all of the ALV's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's why I wanted to know if there's a way to get which of the ALV's is triggering the handle_double_click event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been searching, and I found this, but it's used for handle_data_changed event &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/sap-technical/abap/handling-changes-to-multiple-alv-grids" target="test_blank"&gt;http://www.erpgenie.com/sap-technical/abap/handling-changes-to-multiple-alv-grids&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 17:39:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436718#M1648155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T17:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: ALV OO - single handler for several grids</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436719#M1648156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fabian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code snippet. It may help you to handle events with one handler for different instances.&lt;/P&gt;&lt;P&gt;[my blog.|http://abap-development-consultant.blogspot.com/2011/05/using-alv-event-handler-for-all.html]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*** INSTANCES&lt;/P&gt;&lt;P&gt;    DATA : go_alv01 TYPE REF TO cl_gui_alv_grid ,&lt;/P&gt;&lt;P&gt;           go_alv02 TYPE REF TO cl_gui_alv_grid ,&lt;/P&gt;&lt;P&gt;           go_alv03 TYPE REF TO cl_gui_alv_grid .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;LINK EVENTS TO INSTANCE&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;SET HANDLER go_event_handler-&amp;gt;handle_double_click FOR ALL INSTANCES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;DEFINITION OF EVENT&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_event_handler DEFINITION&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;class lcl_event_handler definition .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  public section .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    class-methods:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     handle_double_click&lt;/P&gt;&lt;P&gt;     for event double_click of cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;     importing e_row e_column sender.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  private  section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endclass.                    "lcl_event_handler DEFINITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;IMPLEMENTATION OF EVENTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLASS lcl_event_handler IMPLEMENTATION&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;class lcl_event_handler implementation .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  method handle_hotspot_click.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   CASE sender.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;     WHEN go_alv01.&lt;/P&gt;&lt;P&gt;     " go_alv01 has fired the event&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;     WHEN go_alv02.&lt;/P&gt;&lt;P&gt;     " go_alv02 has fired the event&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;     WHEN go_alv03.&lt;/P&gt;&lt;P&gt;     " go_alv03 has fired the event&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;   ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  endmethod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 18:05:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436719#M1648156</guid>
      <dc:creator>huseyindereli</dc:creator>
      <dc:date>2012-01-04T18:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: ALV OO - single handler for several grids</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436720#M1648157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're a genius Hüseyin Dereli!!&lt;/P&gt;&lt;P&gt;I've implemented the solution you gave me, and it's working!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Thank you very much for your reply &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jan 2012 19:29:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-oo-single-handler-for-several-grids/m-p/8436720#M1648157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-04T19:29:07Z</dc:date>
    </item>
  </channel>
</rss>

