Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Change standard pf-status of alv using class CL_GUI_ALV_GRID

0 Kudos

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 !!

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor

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

5 REPLIES 5

former_member156446
Active Contributor
0 Kudos

CL_GUI_ALV_GRID=>SET_TOOLBAR

0 Kudos

Do you mean method "SET_TOOLBAR_INTERACTIVE" or event toolbar ? I already use this method and this event .

MarcinPciak
Active Contributor

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

0 Kudos

Your response is good, but i I would copy pf-status standard for alv and set it with class cl_gui_alv_grid; !

0 Kudos

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