04-18-2007 7:16 AM
Hi All,
When I create an ALV Grid, I dont see the Insert Row and Delete Row buttons in the toolbars by default. But when I see the class CL_GUI_ALV_GRID, I see two attributes named MC_FC_LOC_INSERT_ROW and MC_FC_LOC_DELETE_ROW. These attributes, I feel are for the insert and delete functionalities only.
Then How can we display them in our toolbar..
Please help me out.
Points are guaranteed for useful answers.
Thanks in advance.
Regards,
Himanshu
04-18-2007 9:26 AM
hi,
1) define local CLASS : DEFINITION.
METHODS:
*for event double click
handle_dclick for event double_click OF cl_gui_alv_grid
importing ES_ROW_NO,
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
PRIVATE SECTION.
ENDCLASS.
2)
implmentation:
METHOD handle_toolbar.
* § 2.In event handler method for event TOOLBAR: Append own functions
* by using event parameter E_OBJECT.
* DATA: ls_toolbar TYPE stb_button.
*....................................................................
* append a separator to normal toolbar
CLEAR ls_toolbar.
ls_toolbar-butn_type = 0.
ls_toolbar-function = 'PICK'.
ls_toolbar-icon = ICON_MASTER_DATA_ACT.
ls_toolbar-quickinfo = 'Debitor anzeigen'.
ls_toolbar-disabled = space.
APPEND ls_toolbar TO e_object->mt_toolbar.
endmethod.
3) after creating grid
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_dclick FOR grid.
SET HANDLER event_receiver->handle_toolbar FOR grid.
...
A.
04-18-2007 9:26 AM
hi,
1) define local CLASS : DEFINITION.
METHODS:
*for event double click
handle_dclick for event double_click OF cl_gui_alv_grid
importing ES_ROW_NO,
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive.
PRIVATE SECTION.
ENDCLASS.
2)
implmentation:
METHOD handle_toolbar.
* § 2.In event handler method for event TOOLBAR: Append own functions
* by using event parameter E_OBJECT.
* DATA: ls_toolbar TYPE stb_button.
*....................................................................
* append a separator to normal toolbar
CLEAR ls_toolbar.
ls_toolbar-butn_type = 0.
ls_toolbar-function = 'PICK'.
ls_toolbar-icon = ICON_MASTER_DATA_ACT.
ls_toolbar-quickinfo = 'Debitor anzeigen'.
ls_toolbar-disabled = space.
APPEND ls_toolbar TO e_object->mt_toolbar.
endmethod.
3) after creating grid
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_dclick FOR grid.
SET HANDLER event_receiver->handle_toolbar FOR grid.
...
A.
04-18-2007 9:30 AM
Hello Himanshu
The INSERT and DELETE buttons will be displayed automatically for <b>editable</b> ALV grids.
If you want to set the entire ALV grid editable you can use method <b>go_grid->set_ready_for_input( '1' )</b>.
Regards
Uwe
04-18-2007 9:32 AM
Yes,
Uwe was right. It makes sense to have those buttons only when the grid is editable.
Check this program to know how to add buttons to the toolbar.
BCALV_GRID_05
Regards,
Ravi
04-18-2007 9:36 AM
Hi Experts.
The Problem is solved.
Thnx a lot for ur useful suggestions.
Regards,
Himanshu