Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Smartform Dynamic colour in the item table

$
0
0

Hi Experts,

 

I have a requirement wherein we need different colours for each item in the table according to a particular condition.

 

If the value in the  column two is 1 ,first item should have a colour blue in the last column

If the col2 is 2, second item should have red colour in the last column.

and accordingly.

 

 

                      Col 1       Col2       Col3      Col4

Row1                                1                   Blue colour

Row2                                2                   Red colour

Row3                                3                   Green colour

 

 

Is this possible in smartforms.

Already tried giving condition in the condition tab and choosing the colour for different text elements,which is not possible.

 

Tried writing the below code in initialisation which is also not helping.

 

* Color

 

*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

**

**

**

**

**

**

*

* FIELD-SYMBOLS : <f_tab> type tsftabdef.

*

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

**

*bREAK-POINT .

**

*LOOP AT <f_tab> INTO l_tabdef  where name = 'ITEM_VALUES'.  "  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 = 'L2'.  " only for one line type is required

*

*

*

**

*

** Coloum information

*

**   Column1 (cell) of the TYPE1

*

*    LOOP AT l_ltypes-tcolinfo INTO l_colinfo." where widthv = '1.31'. .

*

**

*

** 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 = '255'.

*        l_border-fillcolor-green = '000'.

*        l_border-fillcolor-blue = '000'.

*        l_border-fillcolor-used = 'X'.

*

*        l_border-cfillcolor-color  = 'X'.

*        l_border-cfillcolor-xred = 'FF'.

*        l_border-cfillcolor-xgreen = '00'.

*        l_border-cfillcolor-xblue = '00'.

*

*        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.




Please suggest and help on how to proceed.


Thanks in advance.


Jojy


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>