Skip to Content
avatar image
Former Member

Smartforms - Colouring a table cell depending on contents


I have a smartform table and I want to change the background colour of one cell depending on the contents of each line.

For example, in my internal table I have the following records:




In my smartform I have a table which loops at my internal table. I want the 'Yellow' line to have the background colour of yellow, the 'Red' line to have a background colour of red etc.

I've looked in my smartstyle sheet to see if I could create a paragraph format or character format with the different colours as backgrounds but I can only change the text colour using those.

I've created different line types with the cell coloured in, but can't insert an IF command before the table line in the 'Main Area' of the table. I can insert an IF command inside the line cell but that doesn't help me as I need to create a different line using the line type with the correct colour.

Can anyone see a solution to this?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 15, 2008 at 03:36 PM

    You can try with Creating Three line types: One with Yellow, one with Red and One with Green.

    Ana depends on the condition you can call the suitable line.

    I have tried to remove / change entire background color.

    Here you can look at my WIKI


    Naimesh Patel

    Add comment
    10|10000 characters needed characters exceeded

    • You can use the Condition tab of the Line type to know which line you have to use.

      Take a flag field in the internal table. (ITAB-FLAG)

      Before coming to the TABLE node, fill the flag as per the requirement to show yellow, red or green.

      ITAB-FLAG = 1 " Green

      ITAB-FLAG = 2 " Yellow

      ITAB-FLAG = 3 " Red

      Use that field in the condition tab.

      For Green line:

      ITAB-FLAG EQ 1

      and so on.


      Naimesh Patel