3

I have an instance of CL_GUI_ALV_GRID referenced by variable mo_alv_grid.

I have a button column in this grid, which after some logic, updates the table mt_alv_grid (backing mo_alv_grid).

I need to be able to trigger the event DATA_CHANGED at this point.

I have tried many methods of CL_GUI_ALV_GRID, like CHECK_DATA_CHANGED and REFRESH_TABLE_DISPLAY and even CL_GUI_CFW=>FLUSH and CL_GUI_CFW=>SET_NEW_OK_CODE( 'ENTER' ). but none of this has worked.

Is there a way to trigger the DATA_CHANGED event, or should I be doing things completely differently ?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
vlad-ardelean
  • 7,480
  • 15
  • 80
  • 124
  • Just to clarify - you have a button in the ALV grid that triggers ABAP code that changes the data in the backend internal table and want the display to be updated? – vwegert Jun 18 '13 at 12:00
  • all of that, but the display IS updated, and I need to trigger DATA_CHANGED event automatically (not even hitting `ENTER` afterwards does it) – vlad-ardelean Jun 18 '13 at 13:30
  • DATA_CHANGED is not supposed to be called if the data is updated programmatically, only when the USER changes the data. – vwegert Jun 18 '13 at 15:00
  • Eventually I redesigned the whole thing :| thx anyway – vlad-ardelean Jun 18 '13 at 16:31

2 Answers2

3

I don't know if this solves your problem, but in order to update the ALV internal table in the PAI, you could use the following method:

DATA lv_entries_are_consisted TYPE abap_bool.
mo_grid->check_changed_data(
  IMPORTING
    e_valid = lv_entries_are_consisted
).
Eduardo Copat
  • 4,941
  • 5
  • 23
  • 40
1

well, it's possible.

1) don't change values in internal table by program 2) create a change protocol of type LVC_T_MODI with a new values for lines needed

then call

CALL METHOD lo_grid->change_data_from_inside
  EXPORTING
    it_style_cells = lt_cells.

where lo_grid is instance of cl_gui_alv_grid and lt_cells table type LVC_T_MODI. please note, that you will need to set field VAL_DATA of layout structure (LVC_S_LAYO) to 'X' when calling ALV grid for the first time to make this work.

after this, class will automatically change internal table for you and call DATA_CHANGE event