2008 Mar 07 11:05 AM
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.
2008 Mar 07 1:13 PM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |