Skip to Content

SET HANDLER not working - No pushbutton shown

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Dec 12, 2011 at 10:35 AM

    Method SET_TOOLBAR_INETRACTIVE has to be called

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 04:35 AM

    Hi,

    I am Posting Sample Code Regarding ALV Grid It Will HelpFul to you Regarding Process.

    I am Posting Only Code Which We Have to Enter in PBO.

    I got Correct Output.

    MODULE STATUS_0100 OUTPUT.

    SET PF-STATUS 'AB'.

    • SET TITLEBAR 'xxx'.

    IF IDENTITY IS INITIAL.

    CREATE OBJECT IDENTITY

    EXPORTING

    CONTAINER_NAME = 'ALVCONTROL'.

    CREATE OBJECT GRID

    EXPORTING

    I_PARENT = IDENTITY.

    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY

    EXPORTING

    • I_BUFFER_ACTIVE =

    • I_BYPASSING_BUFFER =

    • I_CONSISTENCY_CHECK =

    I_STRUCTURE_NAME = 'ZALVGRID_DISPLAY'

    *

    • IS_VARIANT =

    • I_SAVE =

    • I_DEFAULT = 'X'

    • IS_LAYOUT =

    • IS_PRINT =

    • IT_SPECIAL_GROUPS =

    • IT_TOOLBAR_EXCLUDING =

    • IT_HYPERLINK =

    • IT_ALV_GRAPHICS =

    • IT_EXCEPT_QINFO =

    • IR_SALV_ADAPTER =

    CHANGING

    IT_OUTTAB = ITAB.

    • IT_FIELDCATALOG =

    • IT_SORT =

    • IT_FILTER =

    • EXCEPTIONS

    • INVALID_PARAMETER_COMBINATION = 1

    • PROGRAM_ERROR = 2

    • TOO_MANY_LINES = 3

    • others = 4

    .

    IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CREATE OBJECT OBJ_CL.

    SET HANDLER OBJ_CL->DC FOR GRID.

    ENDIF.

    IF L_IDENTITY IS INITIAL.

    CREATE OBJECT L_IDENTITY

    EXPORTING

    CONTAINER_NAME = 'LOGO'

    .

    CREATE OBJECT L_TREE

    EXPORTING

    I_PARENT = L_IDENTITY.

    PERFORM LOGOSUB USING L_LOGO.

    CALL METHOD L_TREE->CREATE_REPORT_HEADER

    EXPORTING

    IT_LIST_COMMENTARY = L_LIST

    I_LOGO = L_LOGO.

    • I_BACKGROUND_ID =

    • I_SET_SPLITTER_HEIGHT =

    • I_MODEL_MODE =

    ENDIF .

    ENDMODULE. " STATUS_0100 OUTPUT

    WarmRegards,

    PavanKumar.G

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.