cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Background Color In Smartforms

Former Member
0 Kudos

Hi,

I am developing a smartform to display monthly attendance of a employee . For Sunday and closed holidays i should display the cell color as RED . I have written code in the Initialization part of the smartform and is given below

   DATA: l_tabdef  TYPE ssftabdef,     " Work Area for the Table

     t_ltypes  TYPE tsfltype,      " Table - Line types

     l_ltypes  TYPE ssfltype,      " Work Area for the table

     t_colinfo TYPE tsfcolinfo,    " Table - Columns

     l_colinfo TYPE ssfcolinfo,    " Work area for the table

     t_border  TYPE tsfctaba,      " Tables - Borders

     l_border  TYPE ssfctaba.      " Work Area for the borde

ASSIGN ('(SAPLSTXBC)TABDEFS') TO <f_tab>.

BREAK-POINT .

LOOP AT <f_tab> INTO l_tabdef where name = 'HEADER'.  "  only for one template

*

* Table line Types

*  Line type TYPE1 from the table MAIN_TABLE

  LOOP AT l_tabdef-tltype INTO l_ltypes where linetype = 'C2'.  " only for one line type is required

*

* Coloum information

*   Column1 (cell) of the TYPE1

    LOOP AT l_ltypes-tcolinfo INTO l_colinfo .

*

* Borders

*   Background color and borders for that cell

      LOOP AT l_colinfo-borders INTO l_border.

*

* Clearing the color parameters for the cell

*        CLEAR: l_border-intensity,              " Intensity

*        l_border-fillcolor-red,          " Red

*        l_border-fillcolor-used,         " Color Used

*        l_border-cfillcolor-color,       " Red color in Hexa

*        l_border-cfillcolor-xred.        " Color used in Hexa

*

        l_border-fillcolor-red = '195'.

        l_border-fillcolor-used = 'Y'.

        l_border-cfillcolor-color  = 'Y'.

        l_border-cfillcolor-xred = 'C3'.

        MODIFY l_colinfo-borders FROM l_border.

      ENDLOOP.

*

      MODIFY l_ltypes-tcolinfo FROM l_colinfo.

    ENDLOOP.

*

    MODIFY l_tabdef-tltype FROM l_ltypes.

  ENDLOOP.

*

  MODIFY <f_tab> FROM l_tabdef.

ENDLOOP.

, but i am not getting the required result. Can you help me in this regard ?

Accepted Solutions (0)

Answers (1)

Answers (1)

aidan_black
Active Contributor
0 Kudos

Hi,

I think you would need to change the background shading via the table painter.  I think a simpler solution would be to use some condition tab relating to date in the Smart Form and call a different table with suitable shading on certain dates.

regards,
Aidan