Add row color in ALV using CL_SALV_TABLE

1
10341

[adsenseyu2]

In this tutorial, we will learn how to add color to the row of an ALV using CL_SALV_TABLE.In our earlier we applied colors to the columns,click here to know how. This is similar to Functional Module ALV, we need an extra column in the output internal table to apply colors to a particular row (or) particular cell. Lets see how we can do it.

To apply colors to row in ALV

  • Create a new column of Type LVC_T_SCOL in your output internal table.
  • Set the above column as Color Column in ALV by using the method SET_COLUMN_COLOR( ).
  • Add the color data to the color column based on your requirement.

Create a program in SE38 and copy the below code.

https://gist.github.com/prakash13t/3dd7da4db24eca246d74#file-rowcolor_salv-abap

Output before:

alv2

[adsenseyu1]

Output after adding colors to row:

alv1

  • BB

    Block possibility of copying and write “Create a program in SE38 and COPY below code”. Nice… Do you really think it will stop people of copying content? Even animals in forest know how to workaround it.