06-08-2010 1:06 PM
Hi,
i have create Events for my ALV-Grid Table (cl_gui_alv_grid).
But there is one Problem!!!!
Which Event must i create, if users write something in the ALV row and press to key "enter" ???
With kind regards
Ersin
06-08-2010 1:35 PM
Thanks for your helps,
i call the "register_edit_event" after "et_table_for_first_display" .
But it doesnt work`??
If i press enter on a row and debug, there is no calling event!!!
CALL METHOD gr_grid_d0100->set_table_for_first_display
EXPORTING
i_consistency_check = l_consistency_check
is_variant = ls_vari
i_save = 'A'
i_default = con_true
is_layout = ls_layo
is_print = ls_prnt
it_hyperlink = lt_hype
CHANGING
it_outtab = gt_outtab[]
it_fieldcatalog = lt_fcat.
CALL METHOD gr_grid_d0100->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
06-08-2010 1:16 PM
- the ALV must be editable
- you must set handler for either event data_changed or data_changed_finished
- then activate the events trigger when you press ENTER with the following
CALL METHOD g_alv_grid_ref->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter. "trigger your handler after ENTER is pressed
Regards
Marcin
06-08-2010 1:19 PM
Hi,
If You want an event to get triggered every time an entry is made/changed in an editable cell, you can use 'DATA_CHANGED' OF CL_GUI_ALV_GRID. This will also trigger whenever one presses enter, after changing an entry.
Else, if You only want this whenever enter if pressed use the following code
'CALL METHOD g_alv_grid_ref->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.'
06-08-2010 1:35 PM
Thanks for your helps,
i call the "register_edit_event" after "et_table_for_first_display" .
But it doesnt work`??
If i press enter on a row and debug, there is no calling event!!!
CALL METHOD gr_grid_d0100->set_table_for_first_display
EXPORTING
i_consistency_check = l_consistency_check
is_variant = ls_vari
i_save = 'A'
i_default = con_true
is_layout = ls_layo
is_print = ls_prnt
it_hyperlink = lt_hype
CHANGING
it_outtab = gt_outtab[]
it_fieldcatalog = lt_fcat.
CALL METHOD gr_grid_d0100->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
06-08-2010 2:06 PM
Did you set the handler for one of forementioned events? If no, please suplement your code with the following
"create handler class
CLASS lcl_gui_alv_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
" Controlling data changes when ALV Grid is editable
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
" To be triggered after data changing is finished
handle_data_changed_finished FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified ,
ENDCLASS.
"implement you handler methods
CLASS lcl_gui_alv_event_receiver IMPLEMENTATION.
METHOD handle_data_changed .
MESSAGE 'Data changed' TYPE 'I'.
ENDMETHOD.
METHOD handle_data_changed_finished .
MESSAGE 'Data changed finished' TYPE 'I'.
ENDMETHOD .
ENDCLASS.
data: g_alv_event_ref TYPE REF TO lcl_gui_alv_event_receiver.
CREATE OBJECT g_alv_event_ref.
"set handlers for these events
SET HANDLER:
g_alv_event_ref->handle_data_changed FOR g_alv_grid_ref,
g_alv_event_ref->handle_data_changed_finished FOR g_alv_grid_ref,
...
"register the events after pressing enter
CALL METHOD g_alv_grid_ref->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Regards
Marcin
06-08-2010 2:39 PM
Check this sample in wiki : [Get Changed Value In ALV Grid Dynamically. |http://wiki.sdn.sap.com/wiki/display/ABAP/GetChangedValueInALVGridDynamically.] it contains everything you required.
Regards,
Raymond
06-09-2010 8:11 AM