Skip to Content
0
Former Member
Sep 23, 2005 at 05:09 PM

Customized icons in the alv grid not working

35 Views

Hi Everyone,

I place some of the buttons in the alv grid toolbar, like the standard sap program BCALV_GRID_05, when i press that button it has to perform something but in my case its not working what could be the problem.

Here is my code:

CLASS lcl_ev_receiver_toolbar DEFINITION.

PUBLIC SECTION.

METHODS:

handle_toolbar

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive,

handle_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm.

PRIVATE SECTION.

ENDCLASS. "lcl_ev_receiver_toolbar DEFINITION

***********************************************************************

  • On Load Toolbar Button

***********************************************************************

CLASS lcl_ev_receiver_toolbar IMPLEMENTATION.

METHOD handle_toolbar.

DATA: ls_toolbar1 TYPE stb_button,

ls_toolbar2 TYPE stb_button.

  • append a separator to normal toolbar

CLEAR ls_toolbar1.

MOVE 3 TO ls_toolbar1-butn_type.

APPEND ls_toolbar1 TO e_object->mt_toolbar.

  • append an icon to show delete

CLEAR ls_toolbar1.

MOVE 'DEL' TO ls_toolbar1-function.

MOVE icon_delete TO ls_toolbar1-icon.

MOVE ' ' TO ls_toolbar1-disabled.

APPEND ls_toolbar1 TO e_object->mt_toolbar.

  • append a separator to normal toolbar

CLEAR ls_toolbar2.

MOVE 3 TO ls_toolbar2-butn_type.

APPEND ls_toolbar2 TO e_object->mt_toolbar.

  • append an icon to show delete

CLEAR ls_toolbar2.

MOVE 'DISPLAY' TO ls_toolbar2-function.

MOVE icon_display TO ls_toolbar2-icon.

MOVE ' ' TO ls_toolbar2-disabled.

APPEND ls_toolbar2 TO e_object->mt_toolbar.

ENDMETHOD. "handle_toolbar

METHOD handle_user_command.

DATA: lt_rows TYPE lvc_t_row.

CASE e_ucomm.

WHEN 'DEL'.

message i350(msg) or perform test.

CALL METHOD cl_gui_cfw=>flush.

IF sy-subrc NE 0.

  • add your handling, for example

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = sy-subrc

txt1 = 'Error in Flush'(500).

ENDIF.

ENDCASE.

ENDMETHOD. "handle_user_command

ENDCLASS. "lcl_ev_receiver_toolbar IMPLEMENTATION

Any help will be of great use to me,

Thanks,

Prabs.