2009 Feb 22 4:16 PM
Hi,
I have 2 alv grid's present in the same screen. These tables are of different structures having a field in common. This field has an F4 help(fixed values defined at field level). So, when i am making changes to this field in any of the two tables, in the datachange handler i am unable to differentiate the table name in which the change has been done.
I am using cl_alv_grid_display for alv.
Kindly help me out in figuring out the exact table in which the changes took place.
Thanks in advance,
Poorvika
2009 Feb 23 5:11 AM
2009 Feb 23 5:14 AM
Hi Poorvika,
You need to define 2 separate event handler methods for your case
and assign one method to each of your ALV grids
as the event DATA_CHANGED does not help in identifying which ALV trigerred the event.
Regards,
Prakash Pandey
Edited by: Prakash Pandey on Feb 23, 2009 6:14 AM
2009 Feb 23 6:02 AM
2009 Feb 23 6:23 AM
define a class , 2 objects to catch this event.
CLASS alv_event_handler DEFINITION DEFERRED.
DATA: ref_handler_alv1 TYPE REF TO alv_event_handler,
ref_handler_alv2 TYPE REF TO alv_event_handler.
CLASS alv_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
*DATA_CHANGED
handle_DATA_CHANGED FOR EVENT DATA_CHANGED OF cl_gui_alv_grid.
ENDCLASS.
CLASS alv_event_handler IMPLEMENTATION.
DATA CHANGE
METHOD handle_DATA_CHANGED.
ENDMETHOD. "handle_double_click
ENDCLASS.
two objects to catch two events of these two alv.
SET HANDLER ref_handler_alv1->DATA_CHANGED FOR ref_grid1.
SET HANDLER ref_handler_alv2->DATA_CHANGED FOR ref_grid2.
2009 Feb 23 9:41 AM
Hi,
What you can do is create different instance for both the grid and use like:-
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
Hope this helps you.
Thanks & Regards,
Tarun
2009 Feb 23 9:49 AM