cancel
Showing results for 
Search instead for 
Did you mean: 

"Custom" grouping and / or colored lines in ALV

Former Member
0 Kudos

Hi!

Two questions:

1. Is it possible to use colors in the ALV for a given set of rows? I'd like to mark rows with a color, which are logically belongs together.

2. Other approach would be to sort the ALV and via that the "similar" rows (i.e. some column values in the rows have the same value ) would be grouped.

The normal ALV grouping feature is too general. E.g if the ALV contains a lot of empty cells, then those cells will be grouped as well, nevertheless they are logically don't belong together -> looks quite weird.

If the custom grouping cannot be realized, then my approach would be the following:

1. Sorting the table. -> rows where the content partially equal are in succession.

2. Manually clear the cells in the second (in my business case only two lines can be partially equal, others are unique) row, which are the same as in the previous row.

3. Use coloring to indicate that these two lines are belonging together.

Best regards,

Peter

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Peter,

It is possible to assign colors to a specific row. But you need to have some work around.

You have to create an extra attribute for each column that you have in your table. The type of that attribute should be of WDUI_TABLE_CELL_DESIGN.

After Instatiating your ALV Component you have to use the following statement for the column that you have to apply the color.

ls_column-r_column->set_cell_design_fieldname( COLUMN1_DESIGN ). Assuming ls_column-r_column will have COLUMN1 as filed name.

There are 16 colors that are defined and each combination from '00' to '15' will define one color.

Look at the structure below. Its a table with 4 columns(2nd and 4th represents colors for first and third columns)

value11 00 value12 00

value21 00 value22 00

value31 02 value32 02.

If you consider the above struture as your output table 3 rows and 4 columns then your third row will be highlighted in green color because 02 represents green. You can hide your second column and fourth column in above example because they represents colors. Use the following statement to hide those columns.

ls_column-r_column->set_visible(

cl_wd_uielement=>e_visible-none ). "ls_column-r_column will have 'COLUMN1_DESIGN'

Let me know if you know more code.

Thank You,

Gajendra.

Former Member
0 Kudos

Hi Gajendra,

thanks for your help.

Regards,

Peter