2006 Dec 02 7:10 AM
hi,
In ALV GRID DISPLAY have to display around 500 records,
and the last record is a summary which is required to be in a different color or to be emphasized .
So how can i do this ?
2006 Dec 02 7:15 AM
Hello Mayun
Colouring an entire row can be done as following:
+Coloring An Entire Row
Coloring a row is a bit (really a bit) more complicated. To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, lets modify declaration of our list data table gt_list.+
*--- Internal table holding list data
DATA BEGIN OF gt_list OCCURS 0 .
INCLUDE STRUCTURE SFLIGHT .
DATA rowcolor(4) TYPE c .
DATA END OF gt_list .
+Code Part 13 Adding the field that will contain row color data
As you guess, you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field
INFO_FNAME
of the layout structure.+e.g.
ps_layout-info_fname = <field_name_containing_color_codes>. e.g. ROWCOLOR
You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
Regards
Uwe
2006 Dec 02 7:29 AM
hi,
chk this link.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
code is there.
Rgds
Anver
<b><i>pls mark all hlful answers</i></b>
2006 Dec 02 11:17 AM
hi mayuri,
The idea is to store the information of each row of the grid
So the properties of any row (i.e color, visible, etc)can be made to differ than any other row
Here are the steps u can follow
1. include a component line_color of type char 4 in the structure type of d table which will be used in the grid....here each row of the table will contain this component in addition to values of the respective fields
2.include this fieldname to the info_fname component of the layout structure
3.To emphasize the last row of the table,
describe itab lines <i>row_no</i>
read table itab index <i>row_no</i> into workarea
workarea-line_color = 'C610' "for red color
or
workarea-line_color = 'C310' "for yellow color
modify itab from workarea.
endloop.
to get the list of available colors check out
domain TCOLOR
Hope this will be helpful
*******Pls mark points if helpful******
Regds,
Vs
2006 Dec 02 2:55 PM
Hi,
ROW coloring is just the same as CELL colouring - just don't give value for fieldname.
Use TYPE-POOLS: COL. Color names like COL_TOTAL are available.
Include color field color TYPE slis_t_specialcol_alv in the structure of the display table alv_tab.
Make this field known in layout parameter alv_layout-coltab_fieldname = 'COLOR'.
READ table alv_tab index sy-tfill.
PERForm alv_color using ' ' COL_TOTAL 1 0 changing alv_tab-color.
This will give the last row intensified yellow, not inverse.
Use the form below and enjoy it in many programs still to come.
*&---------------------------------------------------------------------*
*& Form alv_color
*&---------------------------------------------------------------------*
* set field color - last wins
*----------------------------------------------------------------------*
FORM alv_color USING pv_fieldname TYPE fieldname
pv_color TYPE c
pv_intensify TYPE i
pv_inverse TYPE i
CHANGING pt_colors TYPE slis_t_specialcol_alv."#EC CALLED
FIELD-SYMBOLS:
<color> TYPE LINE OF slis_t_specialcol_alv.
DATA:
ls_colors TYPE LINE OF slis_t_specialcol_alv.
READ TABLE pt_colors ASSIGNING <color> WITH KEY
fieldname = pv_fieldname
BINARY SEARCH.
IF sy-subrc = 0.
<color>-color-col = pv_color.
<color>-color-int = pv_intensify.
<color>-color-inv = pv_inverse.
ELSE.
ls_colors-fieldname = pv_fieldname.
ls_colors-color-col = pv_color.
ls_colors-color-int = pv_intensify.
ls_colors-color-inv = pv_inverse.
INSERT ls_colors INTO pt_colors INDEX sy-tabix.
ENDIF." sy-subrc = 0.
ENDFORM. "alv_color
Regards,
Clemens