Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with New Pushbutton in OO ALV

former_member305388
Active Contributor
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try calling method in PBO

CALL METHOD object->set_toolbar_interactive.

Regards,

Ravi.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Try calling method in PBO

CALL METHOD object->set_toolbar_interactive.

Regards,

Ravi.

benu_mariantony2
Participant
0 Kudos

the following method is missing in your code...

lo_alv->set_toolbar_interactive( ).