11-19-2008 9:35 AM
how can i add new buttons on the toolbar? i can exclude button from the standard but how can i add some?
11-19-2008 9:37 AM
Hi,
Check this example program in your R3 system: BCALV_TEST_GRID_TOOLBAR
regards,
Advait
11-19-2008 9:53 AM
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
METHODS : HANDLE_TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD HANDLE_TOOLBAR.
DATA: WA_TOOLBAR TYPE STB_BUTTON.
CLEAR WA_TOOLBAR.
MOVE 'EDIT' TO WA_TOOLBAR-FUNCTION.
MOVE ICON_SYSTEM_COPY TO WA_TOOLBAR-ICON.
MOVE 'Sets Grid in Edit Mode' TO WA_TOOLBAR-QUICKINFO.
MOVE 'Edit' TO WA_TOOLBAR-TEXT.
MOVE ' ' TO WA_TOOLBAR-DISABLED.
APPEND WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
CLEAR WA_TOOLBAR.
MOVE 'UPDATE' TO WA_TOOLBAR-FUNCTION.
MOVE ICON_SYSTEM_SAVE TO WA_TOOLBAR-ICON.
MOVE 'Updates all the changed data' TO WA_TOOLBAR-QUICKINFO.
MOVE 'Update' TO WA_TOOLBAR-TEXT.
MOVE ' ' TO WA_TOOLBAR-DISABLED.
APPEND WA_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
ENDMETHOD. "HANDLE_TOOLBAR
ENDCLASS "lcl_event_handler IMPLEMENTATION
MODULE STATUS_3000 OUTPUT.
..........................
CREATE OBJECT GR_EVENT_HANDLER.
SET HANDLER GR_EVENT_HANDLER->HANDLE_TOOLBAR FOR GR_ALVGRID.
11-19-2008 10:25 AM
how is the definition for GR_EVENT_HANDLER ?
is there another alternative without a class definition and implementation to create additional button on the toolbar?
11-19-2008 10:39 AM
11-19-2008 10:43 AM
Hi,
1) if u want to add new button to toolbar in standard program, it isn't possible
2) in another case if u want to create button in alv toolbar in your program it's possible for you need copy alv toolbar from standard program and then u can change it (create&delete buttons etc.) . for example u can copy gui-status 'STANDARD' of BALVSD01 program.
11-19-2008 11:09 AM
11-19-2008 12:10 PM
if it's question for me , i didn't understand u . what though how u define your reference ? u can only exclude buttons by program but how adding button i explaned u above .
Edited by: Ruslan Burhanov on Nov 19, 2008 1:10 PM
11-19-2008 5:54 PM
hello,
when I copy the standard tololbar of the mentioned progam, how do i create new buttons for it?
11-19-2008 6:40 PM
u can add new button for copied toolbar by follow
1) open GUI-status for changing
2) add new item in any position of application toolbar (Edit -> Insert -> Entry)
3) in that item u can your button
thats all
11-19-2008 6:42 PM
sorry ruslan, i think i didn't explain it enougt, i dont want to have a menue toolbar, what i want to have is the alv grid toolbar which is above the alv and not under the menue.
11-20-2008 5:53 AM
hi,
just create a status
SET PF-STATUS 'ZTEST'.
click on ztest-->here u can add ur own buttons.
Best Regards,
Venkat
11-20-2008 8:23 AM
i don't mean the pf-status which is for the whole screen, i mean the toolbar for the alv, which belongs to the alv
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ZRFID'
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = lt_alv
it_fieldcatalog = lt_fct1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
with my lt_exclude i can remove button, but how can i add buttons?
11-20-2008 10:11 AM
now i have this one:
*---------------------------------------------------------------------*
* CLASS LCL_EVENT_HANDLER DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
toolbar FOR EVENT toolbar
OF cl_gui_alv_grid
IMPORTING e_object
e_interactive.
ENDCLASS. "lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD toolbar.
PERFORM toolbar USING e_object
e_interactive.
ENDMETHOD. "toolbar
ENDCLASS. "lcl_event_handler IMPLEMENTATION
***********************************************************************************
FORM toolbar USING e_object TYPE REF TO cl_alv_event_toolbar_set
e_interactive TYPE char1.
DATA: ls_toolbar TYPE stb_button.
*... Normal Button
CLEAR ls_toolbar.
ls_toolbar-function = 'Toggle'. "#EC NOTEXT
ls_toolbar-icon = icon_toggle_display_change.
ls_toolbar-butn_type = '0'.
ls_toolbar-disabled = space.
ls_toolbar-text = 'Toggle'. "#EC NOTEXT
ls_toolbar-quickinfo = space.
ls_toolbar-checked = space.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDFORM. " toolbar
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'STRUCTURE'
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = lt_alv
it_fieldcatalog = lt_fct1
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
but i don't have a additional button 'Toggle' in my toolbar.
11-20-2008 10:18 AM
Hi,
First you need to create an object of the event handler class and then you need to set the handler of the event class method to the grid as well.
Do this before you call the method set_table_for_first_display of the grid
create object gr_event_handler .
" you must declare gr_event handler as gr_event_handler type ref to lcl_event_handler
set handler gr_events_sflight->toolbar
for grid1.
regards,
Advait
Edited by: Advait Gode on Nov 20, 2008 11:19 AM
11-20-2008 12:25 PM