08-05-2005 10:38 AM
Hi all,
I have some problems with the ALV Grid.
Target:
I have an ALV Grid with editable Column. If the user insert, update or delete the content of the column and leave the column (column lost focus) i'd like to do somthing - this means I need a event for this action. Can anybody help me to solve this problem?
Thanks Stefan
08-05-2005 10:40 AM
In PBO,
call method o_alvgrid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'X'.
<lfs_fieldcat>-coltext = 'X'.
<lfs_fieldcat>-checkbox = 'X'.
<lfs_fieldcat>-edit = 'X'.
08-05-2005 10:40 AM
In PBO,
call method o_alvgrid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
CASE <lfs_fieldcat>-fieldname.
WHEN 'X'.
<lfs_fieldcat>-coltext = 'X'.
<lfs_fieldcat>-checkbox = 'X'.
<lfs_fieldcat>-edit = 'X'.
08-05-2005 10:48 AM
Hi thanks for this answer,
but I'm not sure how I have to catch this event -
sorry for this newbie question
Thanks Stefan
08-05-2005 11:04 AM
See this link
http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm
If u want i will send u sample code. Give me ur mail id
08-05-2005 11:26 AM
Hi,
Use ths also along with ur code:
CALL METHOD o_alvgrid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid .
Hope that helps you,
Regards,
Anjali
08-05-2005 12:15 PM
Hi,
thanks for help - bt it dosn't work 100% correct -
I have implement
CALL METHOD gv_alv_cw->register_edit_event
EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
set handler gv_eventhandler->handle_data_changed for gv_alv_cw.
set handler gv_eventhandler->handle_data_changed_finished for gv_alv_cw.
and the methods handle_data_changed_finished and handle_data_changed
But if I change the value of a column (simple text) and leave the column via Tab or by clicking (one times) on the next column the event dosn't raise. But the normal way to fill the table is pressing tab switching between columns - So I have to get the event after pressing the tab or mouse.
Thanks
Stefan
08-05-2005 12:17 PM
Hi,
there is a way to say thanks in SDN
Kindly reward points for the answers which helped u.
08-05-2005 12:27 PM
You should do the coding in this order.
1° Create ALV object
2° Do the link between Event handler and the ALV via the set handler.
3° Fielcat creation
4° CAll ALV method set_table_for_first_display.
5° Call ALV method register_edit_event.
*/ REgister the return key as event
CALL METHOD gref_alv_up->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified
08-05-2005 10:53 AM
08-05-2005 11:18 AM
Use Event data_changed and data_changed_finished of the cl_gui_alv_grid.Then all you have to do is registering your event to the ALV and fill the methods with what you want to do.In ALV Grid, There is no event to capture the lost focus of a column if you don't modify it.
CLASS lcl_event_receiver DEFINITION.
METHODS:
*$ Check the change
handle_data_changed FOR EVENT data_changed
OF cl_gui_alv_grid
IMPORTING er_data_changed
e_ucomm
e_onf4
e_onf4_before
e_onf4_after,
handle_data_changed_finished
FOR EVENT data_changed_finished
OF cl_gui_alv_grid
IMPORTING e_modified
et_good_cells
sender,
ENDCLASS. "LCL_EVENT_RECEIVER DEFINITION