Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OOPS ALV: data changes are not captured

Former Member
0 Likes
3,309

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

11 REPLIES 11
Read only

Former Member
0 Likes
1,671

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

Read only

Former Member
0 Likes
1,671

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

Read only

0 Likes
1,671

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

Read only

0 Likes
1,671

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



Read only

0 Likes
1,671

I register two event handlers for two ALV Grid

Read only

former_member209120
Active Contributor
0 Likes
1,671
Read only

SwadhinGhatuary
Active Contributor
0 Likes
1,671

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.....

Read only

Former Member
0 Likes
1,671

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.

Read only

0 Likes
1,671

called already

Read only

Former Member
0 Likes
1,671

closed

Read only

0 Likes
1,671

Hi t s,

Close this thread as marked Assumed  Answered.