‎2006 Jun 16 10:11 AM
Hi All,
i am using BEFORE_USER_COMMAND event of CL_GUI_ALV_GRID class.
But there are standard button that can't be captured in that event. The buttons are:
1. MC_FC_LOC_COPY_ROW (duplicate row button)
2. MC_FC_LOC_DELETE_ROW (delete row button)
etc...
could you help me how to capture this button before executed ?
Thank you in advance.
Sandi
‎2006 Jun 16 10:21 AM
Hi Sandi,
I'm not sure but the before_user_command event doesn't work with standard buttons.
Once I solved this problem making a custom button with the some fcode of the standard one; i.e you can create two button with fcode
1. MC_FC_LOC_COPY_ROW (duplicate row button)
2. MC_FC_LOC_DELETE_ROW (delete row button)
and try to catch now they with the event.
Bye
enzo
‎2006 Jun 16 10:21 AM
Hi Sandi,
I'm not sure but the before_user_command event doesn't work with standard buttons.
Once I solved this problem making a custom button with the some fcode of the standard one; i.e you can create two button with fcode
1. MC_FC_LOC_COPY_ROW (duplicate row button)
2. MC_FC_LOC_DELETE_ROW (delete row button)
and try to catch now they with the event.
Bye
enzo
‎2006 Jun 16 10:38 AM
Hi,
COPY button, and Delete row , append row these buttons they don't link to BEFORE_USER_COMMAND .
they are used to make the changes to the Grid so using the below things you can trigger the DATA_CHANGES event, but not the BEFORE_USER_COMMAND event.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = cl_gui_alv_grid=>mc_evt_modified.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = cl_gui_alv_grid=>mc_evt_enter.Regards
vijay
‎2006 Jun 16 10:47 AM
Hi Vijay,
Thanks for your reply,
When we put DATA_CHANGES, all the last cursor position & last scroll position has been changed.
I want to save the cursor & scroll position before process of double row is executed. Actually I want to override CLICK_ROW_COL in CL_GUI_ALV_GRID class that I have inherited.
Do you know how to do that ?
Thanks,
Sandi
‎2006 Jun 16 11:11 AM
Hi Sandi,
in the event data_changes you can get the row position and column position.
for reference you can see the Program <b>BCALV_EDIT_04</b>
this is for delete and append rows.
check this ..
line#161
method handle_data_changed.
*
data: ls_good type lvc_s_modi,
l_price type s_price,
ls_new type lvc_s_moce.
error_in_data = space.
* check if there exist double entries
call method check_double_entries( er_data_changed ).
* remember new or deleted lines for saving
call method update_delta_tables( er_data_changed ).
* check mt_good_cells semantically
call method perform_semantic_checks( er_data_changed ).
if error_in_data = 'X'.
call method er_data_changed->display_protocol.
endif.
endmethod.Regards
Vijay
‎2008 Feb 21 12:24 PM
Hi,
I created a nice work around...
CLASS lcl_event_handler DEFINITION.
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_toolbar.
DATA:
l_toolbar TYPE stb_button.
Here I replace SAP standard functions with own functions
READ TABLE e_object->mt_toolbar INTO l_toolbar
WITH KEY function = '&LOCAL&APPEND'.
IF sy-subrc = 0.
l_toolbar-function = 'OWN_APPEND'.
MODIFY e_object->mt_toolbar FROM l_toolbar INDEX sy-tabix.
ENDIF.
READ TABLE e_object->mt_toolbar INTO l_toolbar
WITH KEY function = '&LOCAL©_ROW'.
IF sy-subrc = 0.
l_toolbar-function = 'OWN_COPY_ROW'.
MODIFY e_object->mt_toolbar FROM l_toolbar INDEX sy-tabix.
ENDIF.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'OWN_APPEND'.
CALL METHOD ref_alv->check_changed_data
IMPORTING
e_valid =
CHANGING
c_refresh = 'X'
.
CREATE YOUR OWN CODE HERE
CALL METHOD ref_alv->refresh_table_display
EXPORTING
is_stable = 'X'
i_soft_refresh =
EXCEPTIONS
finished = 1
others = 2
.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Kind regards
Keld Gregersen
‎2008 Sep 09 1:16 AM