Skip to Content
0
Dec 12, 2011 at 05:16 AM

SET HANDLER not working - No pushbutton shown

226 Views

Hi Experts!!

We have a customized global class ZCL_DISPLAY in which we have a method SET_DISPLAY. In this method go_grid (Public Instance attribute type ref to CL_GUI_ALV_GRID) is being instantiated and then being displayed using go_grid->set_table_for_first_display.

Now I am writing a report. Below is the code:

data: lci_display type ref to zcl_display.

CLASS lcl_event_handler DEFINITION.
  PUBLIC SECTION.
  CLASS-METHODS: handle_toolbar FOR EVENT toolbar
                                OF cl_gui_alv_grid
                                IMPORTING e_object.
ENDCLASS.

CLASS lcl_event_handler IMPLEMENTATION.
  METHOD handle_toolbar.
    DATA: ls_toolbar  TYPE stb_button.
    CLEAR ls_toolbar.
    MOVE 3 TO ls_toolbar-butn_type.
    APPEND ls_toolbar TO e_object->mt_toolbar.

    CLEAR ls_toolbar.
    MOVE 'TEST' TO ls_toolbar-function.
    MOVE icon_calculation TO ls_toolbar-icon.
    MOVE  'Test Button' TO ls_toolbar-quickinfo.
    MOVE 'Test' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
  ENDMETHOD.
ENDCLASS.

start-of-selection.
* Instanzen erzeugen
  create object: lci_display.

Then in PBO of screen, I have a module in which the below code is present:

  lci_display->set_display(
      exporting id_container_name = 'CC_TEST'
                id_structure_name = 'ZTEST'
      changing  ct_outtab         = it_data ).

  SET HANDLER lcl_event_handler=>handle_toolbar
      FOR lci_display->go_grid.

lci_display->go_grid is being taken correctly, but I cannot see any pushbutton on the ALV list.

Can somebody tell me where I did mistake? Thanks a lot!!