Application Development and Automation 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: 
Read only

Problem with ALV Toolbar

Former Member
0 Likes
442

Hi,

I have added a button on my editable ALV Toolbar -delete as I wanted to put my own functionality for it .

But this button is not getting displayed on my toolbar for the first time in the ALV . This ALV gets displayed on the double click of some other ALV .

When I double click on a particular row for the first item on my main ALV , this button does not get displayed .

When I double click it for the second item delete button gets displayed on the toolbar .

Please could someone help me out with this .

Regards,

Sushanth H.S.

Hi,

I have added a button on my editable ALV Toolbar -delete as I wanted to put my own functionality for it .

But this button is not getting displayed on my toolbar for the first time in the ALV . This ALV gets displayed on the double click of some other ALV .

When I double click on a particular row for the first item on my main ALV , this button does not get displayed .

When I double click it for the second item delete button gets displayed on the toolbar .

Please could someone help me out with this .

Regards,

Sushanth H.S.

1 REPLY 1
Read only

Former Member
0 Likes
393

Try the below code....



CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*To add new functional buttons to the ALV toolbar
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive .
ENDCLASS.

CLASS lcl_event_handler IMPLEMENTATION .
*Handle Toolbar
METHOD handle_toolbar.
PERFORM handle_toolbar USING e_object e_interactive .
ENDMETHOD .
ENDCLASS.

FORM handle_toolbar USING i_object TYPE REF TO cl_alv_event_toolbar_set .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO i_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'PER' TO ls_toolbar-function. "#EC NOTEXT
MOVE icon_display_text TO ls_toolbar-icon.
MOVE 'Passenger Info'(201) TO ls_toolbar-quickinfo.
MOVE 'Passenger Info'(201) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
MOVE 2 TO ls_toolbar-butn_type.
MOVE icon_calculation TO ls_toolbar-icon.
MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
MOVE ' ' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
APPEND ls_toolbar TO i_object->mt_toolbar.
ENDFORM .

DATA gr_event_handler TYPE REF TO lcl_event_handler .
.. ..
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .

call gr_alvgrid->set_table_for_first_display....

Hope this helps.

Thanks,

Balaji