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

ALV data change event handling

Former Member
0 Kudos
5,185

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

6 REPLIES 6
Read only

Former Member
0 Kudos
1,708

hi

check with this tables

CDHDR

CDPOS

Read only

Former Member
1,708

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

Read only

Former Member
0 Kudos
1,708

Hi,

Check the below Link

Hope this helps you.

Regards,

Anki Reddy

Read only

Former Member
0 Kudos
1,708

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.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,708

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

Read only

Former Member
0 Kudos
1,708

Hi Poorvika,

kindly go through this link below:

Hope it helps

Regrds

Mansi