Skip to Content

Problem with New Pushbutton in OO ALV

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

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2011 at 07:28 AM

    Hi,

    Try calling method in PBO

    CALL METHOD object->set_toolbar_interactive.

    Regards,

    Ravi.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2011 at 07:34 AM

    the following method is missing in your code...

    lo_alv->set_toolbar_interactive( ).

    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.