07-08-2010 5:02 PM
Hy everyone, I have to intercept when user press the filter button from the alv standard toolbar; maybe I can copy the standard pf-status from alv and set a custom pf-status like using cl_alv_table; but i have to develope with class CL_GUI_ALV_GRID for edit some cell... Is it any way to do this ?
Thank you very much !!
07-09-2010 11:04 AM
I don't quite understand your requirement. Do you mean you want to catch the action when filter button is pressed and suppress its execution performing some custom action instead?
If so you have to use event before_user_command , check inside if action is generated by filter and stop any further processing
"class lcl_handler definition
method handle_before_user_command FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm sender.
"implementation
METHOD handle_before_user_command .
"overriding standard function
CASE e_ucomm.
WHEN '&MB_FILTER'.
"suppress ALV further execution
CALL METHOD sender->set_user_command
EXPORTING
i_ucomm = space.
"do your custom coding
ENDCASE.
ENDMETHOD
SET HANDLER g_alv_event_ref->handle_before_user_command FOR g_alv_grid_ref.
Regards
Marcin
07-08-2010 5:57 PM
07-09-2010 10:22 AM
Do you mean method "SET_TOOLBAR_INTERACTIVE" or event toolbar ? I already use this method and this event .
07-09-2010 11:04 AM
I don't quite understand your requirement. Do you mean you want to catch the action when filter button is pressed and suppress its execution performing some custom action instead?
If so you have to use event before_user_command , check inside if action is generated by filter and stop any further processing
"class lcl_handler definition
method handle_before_user_command FOR EVENT before_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm sender.
"implementation
METHOD handle_before_user_command .
"overriding standard function
CASE e_ucomm.
WHEN '&MB_FILTER'.
"suppress ALV further execution
CALL METHOD sender->set_user_command
EXPORTING
i_ucomm = space.
"do your custom coding
ENDCASE.
ENDMETHOD
SET HANDLER g_alv_event_ref->handle_before_user_command FOR g_alv_grid_ref.
Regards
Marcin
07-09-2010 12:58 PM
Your response is good, but i I would copy pf-status standard for alv and set it with class cl_gui_alv_grid; !
07-09-2010 1:14 PM
PF-STATUS is the one which uses screen not alv . So you can setup only pf-status in PBO just before screen is displayed (and this one will refer to screen). If you want to maintain the toolbar for ALV you have to use parameter it_toolbar_excluding of method set_table_for_first_display or add your custom functions by means of set_toolbar_interactive .
I guess you want to achieve what is possibile in SALV (setting pf-status using method >set_screen_status ). But if you notice, OO ALV is always embraced in MODULE PBO ...of the screen (so requires screen to be shown), while SALV never uses screen. Futhermore first one has ALV toolbar activated by default (not application toolbar ) while the latter doesn't have its own toolbar, so uses this application toolbar instead to keep its specific functions there.
So those two approaches are different in their nature. First requires nothing to be activated (and if required pf-status can also be set for screen separately), the second needs explicit method call to activate the same. So to fulfill your requirement you have to go for solution with hiding entire toolbar/excluding specific functions/adding your own. You can't use pf-status here for ALV toolbar.
Regards
Marcin