‎2012 Feb 26 6:36 AM
Hi All,
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.
I couldn't find anything matching these events in the various CL_SALV* classes.
Thanks and Regards,
Vidya.
‎2012 Feb 26 8:35 PM
SALV Model has Functions object which does the job similar to TOOLBAR Event.
In SALV, Add the function in the ALV grid, get the function object and call the method ADD_FUNCTION.
*... §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->get_functions( ).
lr_functions->set_all( gc_true ).
*... §3.2 include own functions
l_text = 'My Button'.
l_icon = icon_complete.
try.
lr_functions->add_function(
name = 'MYFUNCTION'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
To handle the added function, register the event USER_COMMAND.
data: lr_events type ref to cl_salv_events_table.
lr_events = gr_table->get_event( ).
create object gr_events.
set handler gr_events->on_user_command for lr_events.
Event handler class
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
Check program SALV_DEMO_TABLE_FUNCTIONS for more information.
Regards,
Naimesh Patel