abapalv

How to update the background color of a cell in an ALV grid?


I have an editable ALV Grid managed via CL_GUI_ALV_GRID. I have defined a cell background color in the color table of each line and that color is displaying correctly. Now I would like to update the color of a cell during the handling of event data_changed (turn the cell from red to green if the changed data is valid). However the background color is not changing.

I have tried these 3 solutions in the method that handles the event data_changed:

None of it worked.

There is a method er_data_changed->modify_style but no method er_data_changed->modify_color.

Thank you.


Solution

  • The ALV class has to have a REFRESH method (or something similar method name, for example by CL_GUI_ALV_GRID it is the method REFRESH_TABLE_DISPLAY). This method has to be called as well, to refresh the ALV output.