cancel
Showing results for 
Search instead for 
Did you mean: 

How to change cell color in a table?

Former Member
0 Kudos

Hello everybody,

I have a question for Web Dynpro ABAP - Table display.

I have a table to be displayed and in this table I would like to change color for certain cells based on its values (e.g. if it has "ERROR" - highlght this cell with red color). This table is a normal table not an ALV.

Please could you kindly help me how can I do this

I have browesd sdn.sap.com but found only one example for WD Java.

Thank you in advance

With the best regards

Andrey

Edited by: Andrey Adov on Jul 7, 2008 9:48 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi andrey....

if you want to do it dynamically, add another field to the internal table that is bound to the table ui element.

this field must be bound to the cell design property. now you can pass values like 1, 2, etc.... to change the colour of the cell.

---regards,

alex b justin

Former Member
0 Kudos

Hi Alex,

Thanks a lot

that has helped:

Short summary:

1. Create new attribute (e.g. with the name "COLOR") in the context with type WDUI_TABLE_CELL_DESIGN.

2. This attribute should be binded with corresponding cell in the layout with CellDesign property.

3. Before binding the table provide this attribute with values for color (01,02, ...):

03 badvalue_dark

05 badvalue_light

04 badvalue_medium

25 calendarAqua

22 calendarBlue

28 calendarBrown

30 calendarGreen

20 calendarMetal

21 calendarPeach

24 calendarPurple

23 calendarRose

27 calendarYellow

06 criticalvalue_dark

08 criticalvalue_light

07 criticalvalue_medium

19 four

09 goodvalue_dark

11 goodvalue_light

10 goodvalue_medium

13 group_level1

14 group_level2

15 group_level3

12 key_medium

01 negative

16 one

02 positive

00 standard

18 three

17 two

31 five

32 selection

34 subtotal

35 subtotal_light

33 total

33 total

4. Bind the table

Thank you once again

Best regards

Andrey

Former Member
0 Kudos

Dear Andrey,

I don't need a dynamic cell design but i just need to fix a color to my table. How can i do that. I don;t have the cell design properties there.

Thanks

Regards,

Bryan

Former Member
0 Kudos

Hi Bryan,

you can select a column of your table in the Layout view, then for this column you would see cellDesign property. Choose a required background color from the drop down menu and save

Best regards

Andrey

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

refer to this blog

Former Member
0 Kudos

Hi

there is an option in the table properties "CELL DESIGN".

u can give different values to get different colors. u can bind an attribute to this property and dynamically pass the values to it based on the values in the column.

regards

chythanya

Former Member
0 Kudos

Hi chythanya,

Thank you for your reply

I have found this Cell_design property but how can change it value for a certain cell.

Could you give me a pice of coding, please?

Thank you onc again

Best regards

Andrey