vlad-ardelean
vlad-ardelean

Reputation: 7622

How to trigger the ALV DATA_CHANGE event manually?

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 ?

Upvotes: 3

Views: 24046

Answers (2)

Eduardo Copat
Eduardo Copat

Reputation: 5151

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

Upvotes: 3

Denis Muzhzhukhin
Denis Muzhzhukhin

Reputation: 109

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

Upvotes: 1

Related Questions