2015 Apr 06 1:56 PM
How to change the Background colour of particular CELL in ALV Grid display(whether it may OOPS ALV / Normal ALV) ?
Actually i have requirement like to change the colours for purticular cells in OOPS alv grid display.
Ans:
1) Declare a filed in your final internal table of type LVC_T_SCOL.
TYPES: BEGIN OF t_final,
cellcolor TYPE lvc_t_scol,
END OF t_final.
2) Declare a structure for a layout.
Data: we_layout TYPE lvc_s_layo.
3) Declare a structure for color.
DATA wel_cellcolor TYPE lvc_s_scol.
4) Pass field name to Layout work area.
we_layout-ctab_fname = 'CELLCOLOR'.
5) At the time of filling the final internal table use the below code inside the LOOP to change background colour of Cell.
wel_cellcolor-fname = (FILED NAME which field cell you want to change the colour)
wel_cellcolor-color-col = '5'. " Green colour
wel_cellcolor-color-int = '1'.
APPEND wel_cellcolor TO we_final-cellcolor.
CLEAR wel_cellcolor.
Finally append this Final work area to your final internal table.
APPEND we_final TO wt_final.
CLEAR: we_final
2015 Apr 06 2:14 PM
2015 Apr 06 2:14 PM