Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Multi Coloring

Venkat_Sesha
Advisor
Advisor
0 Kudos
108

Hi All,

I have a simple requirement. My requirement is I would Like to Color a ALV grid Cell.

But, I want to color the cell in two ways.

1. Background Color of the particular Cell must be one color (Lets Say Yellow)

2. Text Color of the Particular Cell must be one color (Lets Say Red).

I have gone through many options like coloring a particular cell either background or Text.

But not both with different colors.

Please suggest that any one has done this in SAP.

Thanks in Advance.

Venkat

5 REPLIES 5

Former Member
0 Kudos
69

HI Venkat ,

Use the below mentioned threads, Hope will help you .

[LINK1|http://help.sap.com/saphelp_nw04/helpdata/en/34/e7eb40c4f8712ae10000000a155106/content.htm]

[LINK2|;

[LINK3|;

B&R,

Saravana.S

Former Member
0 Kudos
69

Hi,

Use this code to Background Color of the particular Cell .Try with the below Code definitely it works.

Example Code :

Data:gd_layout type slis_layout_alv.

gd_LAYOUT-coltab_fieldname = 'CELLCOLOR'.

DATA: WA_CELLCOLOR TYPE LVC_S_SCOL.

DATA: ld_index TYPE SY-TABIX.

LOOP AT IT_EKKO into wa_ekko.

LD_INDEX = SY-TABIX.

  • Set colour of EBELN field to various colors based on sy-tabix value

WA_CELLCOLOR-FNAME = 'EBELN'.

WA_CELLCOLOR-COLOR-COL = sy-tabix. "color code 1-7, if outside rage defaults to 7

WA_CELLCOLOR-COLOR-INT = '1'. "1 = Intensified on, 0 = Intensified off

WA_CELLCOLOR-COLOR-INV = '0'. "1 = text colour, 0 = background colour

APPEND WA_CELLCOLOR TO wa_ekko-CELLCOLOR.

MODIFY it_ekko from wa_ekko INDEX ld_index TRANSPORTING CELLCOLOR.

  • Set colour of NETPR field to color 4 if gt 0

if wa_ekko-netpr gt 0.

WA_CELLCOLOR-FNAME = 'NETPR'.

WA_CELLCOLOR-COLOR-COL = 4. "color code 1-7, if outside rage defaults to 7

WA_CELLCOLOR-COLOR-INT = '0'. "1 = Intensified on, 0 = Intensified off

WA_CELLCOLOR-COLOR-INV = '0'. "1 = text colour, 0 = background colour

APPEND WA_CELLCOLOR TO wa_ekko-CELLCOLOR.

MODIFY it_ekko from wa_ekko INDEX ld_index TRANSPORTING CELLCOLOR.

endif.

  • Set colour of AEDAT field text to red(6)

WA_CELLCOLOR-FNAME = 'AEDAT'.

WA_CELLCOLOR-COLOR-COL = 6. "color code 1-7, if outside rage defaults to 7

WA_CELLCOLOR-COLOR-INT = '0'. "1 = Intensified on, 0 = Intensified off

WA_CELLCOLOR-COLOR-INV = '1'. "1 = text colour, 0 = background colour

APPEND WA_CELLCOLOR TO wa_ekko-CELLCOLOR.

MODIFY it_ekko from wa_ekko INDEX ld_index TRANSPORTING CELLCOLOR.

ENDLOOP.

Venkat_Sesha
Advisor
Advisor
0 Kudos
69

Hi All,

Thanks for the comments. I clearly mentioned in the requirement that, I already googled and tested all the comments mentioned here.

Once again for a better Idea. My Requirement is : In the ALV GRID Cell, It should Have Back ground as Yellow and the Text in it should be Red.

Shravan, it was a good option to EMPHASIZE. But FYI... When we are already using LVC_S_SCOL to color the Text. we cant use EMPHASIZE.

Please let me know any other suggestions.

Thanks In Advance,

Venkat.

Edited by: VENKAT SESHA on Jan 27, 2012 10:46 AM

0 Kudos
69

Hi Venkat,

I do not think this is possible. Last year I was searching for the same requirement which you are after.

Lets hope a solution is available Now.

Cheers!

former_member15255
Active Participant
0 Kudos
69

Hi Venkat,

The requireoment with reference to cell is not possible i guess. But with reference column is possible class : CL_SALV_COLUMNS_TABLE

Thanks & Regards

Suresh Nair