‎2013 Sep 13 4:40 AM
Hi,
I created an editable ALV using alv class. If I input data and press save directly, the new data cannot be stored. But after inputting a data, and press another cell, then the new data can be captured.
Best regards,
ts
‎2013 Sep 13 8:39 AM
best way to analyse is to put a break-point in your save command and check what is happening,
Please refer this link for more details: http://wiki.scn.sap.com/wiki/display/Snippets/ALV+functionality+using+OOPS
‎2013 Sep 13 8:47 AM
Hi,
Below are the steps to achieve this functionality.
1. Register the event:
*--for tab
CALL METHOD go_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
*-- for enter
CALL METHOD go_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
2. Get the changed row,with this below code your changed data row will be selected :
CALL METHOD go_alv->check_changed_data.
3. Handle the event:
SET HANDLER go_respond_events->handle_data_changed_finish FOR go_alv.
4. You have to create the class for this before. In this class you have to update that value:
CLASS respond_events DEFINITION FINAL .
PUBLIC SECTION .
METHODS: handle_data_changed_finish FOR EVENT data_changed_finished
OF cl_gui_alv_grid.
ENDCLASS . "respond_events definition
CLASS respond_events IMPLEMENTATION .
METHOD handle_data_changed_finish.
LOOP AT <your intarnal tablewhich used for display> INTO <ls_>.
**you will have the updated data here
ENDLOOP.
ENDMETHOD. "handle_data_changed
ENDCLASS . "respond_events implementation
Regards,
Supratik
‎2013 Sep 13 11:48 AM
Hi Supratik,
Thank you for your reply. All the codes are implemented. I think the problem lie in the conflict between two event handlers. There are two alv grid at the same screen and one event handler for each of them. It is found that one event handler cannot be registered. I still work on the solution.
Best regards,
ts
‎2013 Sep 13 1:13 PM
Hi TS,
is event handler registered for both the events? like
SET HANDLER go_respond_events->handle_data_changed_finish FOR go_alv1.
SET HANDLER go_respond_events->handle_data_changed_finish FOR go_alv2.
Regards,
Supratik
‎2013 Sep 15 3:31 AM
‎2013 Sep 14 4:40 AM
Hi t s,
See this links for your reference
http://wiki.scn.sap.com/wiki/display/ABAP/Editable+ALV+through+OOPS
‎2013 Sep 14 6:48 AM
hallo Abaper,
put this piece code in privious p_valid is space if any changes is occurred or not
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_repid = sy-repid
e_grid = it_grid.
CALL METHOD it_grid->check_changed_data
IMPORTING
e_valid = p_valid.
if P_VALID = 'X'.
your code piece.....
‎2013 Sep 14 9:54 AM
Hello,
CALL METHOD it_grid->check_changed_data
IMPORTING
e_valid = p_valid
Call this method in the handle data changed event in the class.
and set handler for this event.
‎2013 Sep 15 3:31 AM
‎2013 Sep 18 5:48 AM
‎2013 Sep 18 5:52 AM