Create own menu_button in ALV toolbar

4.5k views Asked by At

I have to create a menu_button in my ALV toolbar,

I searched in SCN and I found some examples.

I know that we have to create a button with the btn_type = 2

like that :

  CLEAR: ls_buttn.
  ls_buttn-icon                   = gi_livra.
  ls_buttn-butn_type              = 2.
  ls_buttn-text                   = 'Vue Livraison'.
  ls_buttn-quickinfo              = 'Vue Livraison'.
  ls_buttn-function               = 'LIVRAISON'.
  APPEND ls_buttn TO e_object->mt_toolbar.

After that I have to handle menu button im my class like that:

METHODS handle_menubtn FOR EVENT menu_button OF cl_gui_alv_grid
                  IMPORTING e_object e_ucomm,

After that to implement it

METHOD handle_menubtn.
    IF e_ucomm = 'LIVRAISON'.
      CALL METHOD e_object->add_function
        EXPORTING
          fcode = 'DISPLAY'
          text  = 'DISPLAY'.
    ENDIF.
  ENDMETHOD.   

But it does not work. The debugger does not go into this method when I click on my button.

Why?

1

There are 1 answers

1
AudioBubble On BEST ANSWER

I think that what you did is right but maybe you forgot to

SET HANDLER lr_event->handle_menubtn FOR your_alv.

Regards,