2005 Oct 26 4:42 PM
hi guys,
I've got some problems with my ALV grid.
INFO:
internal table with fields: PGMID, OBJ, OBJN, COMP
Before a row is deleted I'd like to check whether this row is meant to be deleted (COMP != APP). Unfortunately I don't know how to accomplish that since I cannot react to the event "&LOCAL&DELETE_ROW".
Any ideas what to to?
Since I don't know how to modify the standard delete row event, I removed this button from the toolbar and created a new one. Unfortunately this new button is always visible/active regardless whether I set set_ready_for_input or not.
Any ideas how to toogle my own toolbar buttons at runtime?
Every answer is appreciated.
Regards,
Ron
hi guys,
I've got some problems with my ALV grid.
INFO:
internal table with fields: PGMID, OBJ, OBJN, COMP
Before a row is deleted I'd like to check whether this row is meant to be deleted (COMP != APP). Unfortunately I don't know how to accomplish that since I cannot react to the event "&LOCAL&DELETE_ROW".
Any ideas what to to?
Since I don't know how to modify the standard delete row event, I removed this button from the toolbar and created a new one. Unfortunately this new button is always visible/active regardless whether I set set_ready_for_input or not.
Any ideas how to toogle my own toolbar buttons at runtime?
Every answer is appreciated.
Regards,
Ron
2005 Oct 26 4:47 PM
What I've done in the past is make the ALV grid have row selection. Then have a button on my application toolbar where the user clicks to delete the selected rows. You can use the method get_selected_rows.
data: index_rows type lvc_t_row,
index like line of index_rows.
* Get Selected rows from alv grid
clear index_rows. refresh index_rows.
call method alv_grid->get_selected_rows
importing
et_index_rows = index_rows.
* Now delete those rows from the ALV grid
loop at index_rows into index.
read table ialv index index-index.
if sy-subrc = 0.
delete ialv.
endif.
endloop.
Welcome to SDN. Please remember to award points for helpful answera and mark you post as solved when you question has been answered. The points system seems to be down right now, so please check back later. Thanks.
Regards,
Rich Heilman
Regards,
Rich Heilman
2005 Oct 26 4:53 PM
Hi Rich,
that's exactly what I did. But instead of adding the buttons to my application toolbar I added them to the grid's toolbar.
Toogling buttons on the application toolbar is a piece of cake.
Thanks four your reply! I guess this solves my problem.
regards,
ron
PS: how can I mark the topic as solved?
2005 Oct 26 5:08 PM
2005 Oct 26 5:03 PM
See An Easy Reference for ALV Grid Control this site by Seder Simsekler.
Best!
Jim
2005 Oct 27 12:06 PM
@Jim:
I know this tutorial, but unfortunately it doesn't cover that topic...
@Rich
I just found a way how to toogle custom buttons on the toolbar of the alv grid. Here it goes:
First of all you need an internal table containing your buttons.
gt_toolbar type table of stb_button
This table is filled before the grid is shown.
form form_initialize_variables using lv_user
changing lt_comps type tt_comp
lt_toolbar like gt_toolbar.
data:
ls_toolbar type stb_button.
clear ls_toolbar.
move 3 to ls_toolbar-butn_type.
append ls_toolbar to lt_toolbar.
clear ls_toolbar.
move 'INS_ROW' to ls_toolbar-function.
move icon_insert_row to ls_toolbar-icon.
move space to ls_toolbar-disabled.
move 'Insert Row' to ls_toolbar-quickinfo.
append ls_toolbar to lt_toolbar.
clear ls_toolbar.
move 'DEL_ROW' to ls_toolbar-function.
move icon_delete_row to ls_toolbar-icon.
move space to ls_toolbar-disabled.
move 'Delete Rows' to ls_toolbar-quickinfo.
append ls_toolbar to lt_toolbar.
endform. "initialize_variables
Now all that's left to do is deciding when to show these buttons. Therefore we register for the event "toolbar" of "cl_gui_alv_grid". This event-handling is done in the following form.
form handle_toolbar using i_object type ref to cl_alv_event_toolbar_set
i_interactive.
data:
ls_toolbar type stb_button,
lv_ready type i,
lv_index type i.
call method gr_alvgrid->is_ready_for_input
receiving
ready_for_input = lv_ready.
if lv_ready EQ 1.
loop at i_object->mt_toolbar into ls_toolbar.
if ls_toolbar-function EQ '&REFRESH'.
lv_index = sy-tabix + 1.
insert lines of gt_toolbar into i_object->mt_toolbar
index lv_index.
endif.
endloop.
endif.
endform.
Whenever the grid is set to ready_for_input = 0, the custom buttons will disappear
regards,
ron
PS: unfortunately the point systems is still unavailable. so, I'll check back later...