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: 

cl_gui_alv_grid, changing backgound color and visual config

Former Member
0 Kudos

Hi 4all...

Someone here know how to use the class cl_gui_alv_grid to build a custom ALV Grid display like distinct col colors, remove gridlines, change the background color...???

The public interface of class don't explain me nothing about that. Searching for methods or properties to set, I find nothing...

8 REPLIES 8

Former Member
0 Kudos

Hi Flavio,

There are several ways to enhance the colouring of your grid.

Coloring rows:

Add a field to your internal table that holds the data to be displayed:

BEGIN OF OUTTAB OCCURS 0.

INCLUDE STRUCTURE <your structure>.

DATA: LINECOLOR(4) TYPE C,

END OF OUTTAB.

Assign a 4 digit color code to this field to change the color of each line. Furthermore you should set the name of this field in the layout:

ZZLAYOUT-INFO_FNAME = 'LINECOLOR'.

Coloring columns:

Set the field EMPHASIZE of the layout structure for the column.

Coloring cells:

Again add a field (in this case a table) to the structure of your table:

BEGIN OF OUTTAB OCCURS 0.

INCLUDE STRUCTURE <your structure>.

DATA: COLORTAB TYPE LVC_T_COL,

END OF OUTTAB.

For each column you want to color add a line to table COLORTAB (for each line of your ALV). Furthermore you should set the name of this table in the layout:

ZZLAYOUT-CTAB_FNAME = 'COLORTAB'.

Hope this helps?

Regards,

John.

0 Kudos

Thaks for ur help...!!!

But my doubt stand around the class cl_gui_alv_grid. My experience with OO Programing (Java, C#, Delphi...) tell that the Class concept of Abap Objects implements a way to do this directly with method(s) invoke or properties set, that's truth...??? If negative, we must use the routine that you show...

0 Kudos

Hi Flavio,

Perhaps it was not clear from my previous post, but coloring the grid is done either by method 'SET_TABLE_FOR_FIRST_DISPLAY' (first time) or 'REFRESH_TABLE_DISPLAY' (after something has been changed in the data display).

Regards,

John.

0 Kudos

But it will be that it does not exist a methos like SET_COLUMN_COLOR USING "col_id" or somethig else that do this work...???

The "methods" concept are so limited....???

0 Kudos

Are you have a IM like MSN or ICQ to talk....????

my UIN: 160939866

0 Kudos

Sorry Flavio, we are not allowed to use MSN/ICQ at work....

And indeed, there are no explicit methods to update row/column/cell coloring.

Regards,

John.

0 Kudos

Thanks 4all...

Former Member
0 Kudos

Hi Flavio,

Did the replies help? If so, don't forget to assign points. I gave some, but feel free to increase them!

See: /people/mark.finnern/blog/2004/08/10/spread-the-love for directions.

Click on the Yellow Star icon in each reply.

You can give:

1 - 10 pointer (solves problem, marks as answered)

2 - 6 pointers (very helpful)

Lots of 2 pointers (helpful)

Thanks!

Linda(and Mark Finnern)