2007 Oct 29 4:45 PM
Hi all,
Here i am adding customised function menus to the tool bars of the Grid .
But when i click on
create radio button on selection screen, it should display all the customised menus to the toolbar.
1. should enable the buttons
create
change
whereas we click on change button it
2. should be in disable mode .
How to exclude this functions from toolbar.
anybody pls
2007 Oct 29 8:11 PM
Hello Madhavi
The following sample report <b>ZUS_SDN_BCALV_GRID_DEMO</b> shows how to inactivate grid toolbar functions. Push <i>repeatedly </i>on the ENTER button and see the effect on the toolbar functions.
[code]PROGRAM ZUS_SDN_BCALV_GRID_DEMO.
DATA: ok_code LIKE sy-ucomm,
gt_sflight TYPE TABLE OF sflight,
g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
grid1 TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container.
----
CLASS lcl_eventhandler DEFINITION
----
*
----
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-DATA:
md_cnt TYPE i.
CLASS-METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object
e_interactive
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
----
CLASS lcl_eventhandler IMPLEMENTATION
----
*
----
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_toolbar.
DATA:
ls_button TYPE stb_button.
ADD 1 TO md_cnt. " a simple counter
LOOP AT e_object->mt_toolbar INTO ls_button FROM 1 TO md_cnt.
ls_button-disabled = 'X'.
MODIFY e_object->mt_toolbar FROM ls_button.
ENDLOOP.
ENDMETHOD. "handle_toolbar
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
----
MAIN *
----
SELECT * FROM sflight INTO TABLE gt_sflight.
CALL SCREEN 100.
----
MODULE PBO OUTPUT *
----
MODULE pbo OUTPUT.
SET PF-STATUS 'MAIN100'.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING container_name = g_container.
Instantiate ALV grid control
CREATE OBJECT grid1
EXPORTING i_parent = g_custom_container.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = gt_sflight.
Set event handler for event TOOLBAR
SET HANDLER:
lcl_eventhandler=>handle_toolbar FOR grid1.
ENDIF.
$Comment: Toolbar can be modified on-the-fly
grid1->set_toolbar_interactive( ).
ENDMODULE. "PBO OUTPUT
----
MODULE PAI INPUT *
----
MODULE pai INPUT.
to react on oi_custom_events:
CALL METHOD cl_gui_cfw=>dispatch.
CASE ok_code.
WHEN 'EXIT'.
PERFORM exit_program.
WHEN OTHERS.
do nothing
ENDCASE.
CLEAR ok_code.
ENDMODULE. "PAI INPUT
----
FORM EXIT_PROGRAM *
----
FORM exit_program.
CALL METHOD G_CUSTOM_CONTAINER->FREE.
CALL METHOD CL_GUI_CFW=>FLUSH.
LEAVE PROGRAM.
ENDFORM. "EXIT_PROGRAM[/code]
2007 Oct 29 9:22 PM