1 Reply Latest reply: Jun 17, 2012 11:25 AM by Paul Hardy RSS

Add a menu button in the toolbar using the new ALV class (CL_SALV_TABLE)

Currently Being Moderated

Hi everybody.

 

I would like to add a menubutton in my toolbar, when using the new ALV class (CL_SALV*).

 

It is easy to do with the old class CL_GUI_ALV_GRID, but since the new CL_SALV* class is easier to use (fieldcats...), I try to use them.

 

I achieve to create my new function as follow :

DATA : gr_alv_table TYPE REF TO cl_salv_table,
       lr_functions TYPE REF TO cl_salv_functions_list.
(...)
* Creation of the ALV
(...)
* Get the functions
lr_functions = gr_alv_table->get_functions( ).
* Add a new function
    TRY.
        l_text = text-b01.
        l_icon = icon_complete.
        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_wrong_call cx_salv_existing.
    ENDTRY.

I have a button, but it is not a menu button. And there is no other parameter in the Add_function method to specify the button type (separator, menu button, normal button and so on).

 

Benoî