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

capturing data changes in alv using classes

Former Member
0 Likes
476

Hello All,

Currently am working on alv report using classes..,In this report am displaying 3 grids in the output in 3 different containers(cl_gui_custom_container)...,Am able to handle the data changes done in the grid at the run time using event data_changed ...,

Now the requirement + problem is ...if i do the changes in all the grids ,,,,,and if i click(hotspot event) on any of the rows/records in any of the grids ...,, I need to be able to capture all the data changes done in all the other grids....,,

for example:-

if i modify some records in all the 3 grids ,,, and if I click any of the row in any of the grid at a time,,, all the changes done in all the grids should be captured.....( in simple words one click all changes )

I tried using data_changed event....., am only able to capture the changes of the grid on which i clicked ( ie.hotspot event) but not the changes which i have done on other grids.....Pls. help me out with the possibilities

Hope am clear..

Thanks

John

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
440

Once you are in event handler for data_change event of one grid use method check_changed_data for all the other grids. It should fire their data_change events too and eventually you should raise all their handlers thereby catching the changes in all of them.

Make sure you do the same in the other handlers (to check changes for other grids but itself).

Regards

Marcin

2 REPLIES 2
Read only

MarcinPciak
Active Contributor
0 Likes
441

Once you are in event handler for data_change event of one grid use method check_changed_data for all the other grids. It should fire their data_change events too and eventually you should raise all their handlers thereby catching the changes in all of them.

Make sure you do the same in the other handlers (to check changes for other grids but itself).

Regards

Marcin

Read only

Former Member
0 Likes
440

Hi friend,

METHOD handle_user_command.

CASE e_ucomm.

WHEN 'UPDATE'.

CALL METHOD r_grid->get_selected_rows

IMPORTING

  • ET_INDEX_ROWS =

et_row_no = it_rows.

LOOP AT it_rows INTO wa_rows.

*****modify the first container data***********

endloop.

CALL METHOD r_grid1->get_selected_rows

IMPORTING

  • ET_INDEX_ROWS =

et_row_no = it_rows1.

LOOP AT it_rows1 INTO wa_rows1.

*****modify the second container data***********

endloop.

CALL METHOD r_grid1->get_selected_rows

IMPORTING

  • ET_INDEX_ROWS =

et_row_no = it_rows2.

LOOP AT it_rows2 INTO wa_rows2.

*****modify the third container data***********

endloop.

endcase.

Now we can create three container and three different grid class object but we are using same method.

UPDATE buttton is common to all three containers.

But one important point when u change the records in container we must select the rows then only selected rows r come to the internal table otherwise it is not come.

CREATE OBJECT r_container

EXPORTING

container_name = 'CONTAINER_1'

CREATE OBJECT r_container2

EXPORTING

container_name = 'CONTAINER_2'

CREATE OBJECT r_container3

EXPORTING

container_name = 'CONTAINER_3'

CREATE OBJECT r_grid

EXPORTING

i_parent = r_container

CREATE OBJECT r_grid1

EXPORTING

i_parent = r_container2

CREATE OBJECT r_grid2

EXPORTING

i_parent = r_container3

NOW WE CAN CALL THE METHOD.

CREATE OBJECT event_receiver1.

SET HANDLER event_receiver1->handle_before_user_command FOR r_grid.

CREATE OBJECT event_receiver1.

SET HANDLER event_receiver1->handle_before_user_command FOR r_grid2.

CREATE OBJECT event_receiver1.

SET HANDLER event_receiver1->handle_before_user_command FOR r_grid3

I thing it should be possible.But u must remeber u must select the records when u modifie in three containersBUT UPDATE button is common to all three containers.

Regards,

MURALII