简体   繁体   中英

Create own menu_button in ALV toolbar

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?

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

SET HANDLER lr_event->handle_menubtn FOR your_alv.

Regards,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM