<?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: Replicating MENU_BUTTON, TOOLBAR events in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replicating-menu-button-toolbar-events/m-p/8633997#M1665155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SALV Model has Functions object which does the job similar to TOOLBAR Event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SALV, Add the function in the ALV grid, get the function object and call the method ADD_FUNCTION.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*... §3.1 activate ALV generic Functions
    data: lr_functions type ref to cl_salv_functions,
          l_text       type string,
          l_icon       type string.

    lr_functions = gr_table-&amp;gt;get_functions( ).
    lr_functions-&amp;gt;set_all( gc_true ).

*... §3.2 include own functions
    l_text = 'My Button'.
    l_icon = icon_complete.
    try.
      lr_functions-&amp;gt;add_function(
        name     = 'MYFUNCTION'
        icon     = l_icon
        text     = l_text
        tooltip  = l_text
        position = if_salv_c_function_position=&amp;gt;right_of_salv_functions ).
      catch cx_salv_existing cx_salv_wrong_call.
    endtry.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To handle the added function, register the event USER_COMMAND.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    data: lr_events type ref to cl_salv_events_table.

    lr_events = gr_table-&amp;gt;get_event( ).

    create object gr_events.
    set handler gr_events-&amp;gt;on_user_command for lr_events.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Event handler class&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
class lcl_handle_events definition.
  public section.
    methods:
      on_user_command for event added_function of cl_salv_events
        importing e_salv_function.
endclass.                    "lcl_handle_events DEFINITION

class lcl_handle_events implementation.
  method on_user_command.
    perform show_function_info using e_salv_function text-i08.
  endmethod.                    "on_user_command
endclass.                    "lcl_handle_events IMPLEMENTATION
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check program SALV_DEMO_TABLE_FUNCTIONS for more information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Feb 2012 20:35:09 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2012-02-26T20:35:09Z</dc:date>
    <item>
      <title>Replicating MENU_BUTTON, TOOLBAR events</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replicating-menu-button-toolbar-events/m-p/8633996#M1665154</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 wanted to know if the events in CL_GUI_ALV_GRID - MENU_BUTTON and TOOLBAR - are available in the new ALV Object Model. If not, is there a way to replicate them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I couldn't find anything matching these events in the various CL_SALV* classes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Feb 2012 06:36:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replicating-menu-button-toolbar-events/m-p/8633996#M1665154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-26T06:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Replicating MENU_BUTTON, TOOLBAR events</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replicating-menu-button-toolbar-events/m-p/8633997#M1665155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SALV Model has Functions object which does the job similar to TOOLBAR Event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SALV, Add the function in the ALV grid, get the function object and call the method ADD_FUNCTION.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*... §3.1 activate ALV generic Functions
    data: lr_functions type ref to cl_salv_functions,
          l_text       type string,
          l_icon       type string.

    lr_functions = gr_table-&amp;gt;get_functions( ).
    lr_functions-&amp;gt;set_all( gc_true ).

*... §3.2 include own functions
    l_text = 'My Button'.
    l_icon = icon_complete.
    try.
      lr_functions-&amp;gt;add_function(
        name     = 'MYFUNCTION'
        icon     = l_icon
        text     = l_text
        tooltip  = l_text
        position = if_salv_c_function_position=&amp;gt;right_of_salv_functions ).
      catch cx_salv_existing cx_salv_wrong_call.
    endtry.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To handle the added function, register the event USER_COMMAND.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    data: lr_events type ref to cl_salv_events_table.

    lr_events = gr_table-&amp;gt;get_event( ).

    create object gr_events.
    set handler gr_events-&amp;gt;on_user_command for lr_events.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Event handler class&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
class lcl_handle_events definition.
  public section.
    methods:
      on_user_command for event added_function of cl_salv_events
        importing e_salv_function.
endclass.                    "lcl_handle_events DEFINITION

class lcl_handle_events implementation.
  method on_user_command.
    perform show_function_info using e_salv_function text-i08.
  endmethod.                    "on_user_command
endclass.                    "lcl_handle_events IMPLEMENTATION
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check program SALV_DEMO_TABLE_FUNCTIONS for more information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Feb 2012 20:35:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replicating-menu-button-toolbar-events/m-p/8633997#M1665155</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2012-02-26T20:35:09Z</dc:date>
    </item>
  </channel>
</rss>

