08-20-2007 10:51 AM
Hi Experts,
I want to make color to parrticular line when it satisfies the condition in ALV report.
I am not using SLIS.
so is there any alternavite to clolor row on specific condition like...NETWR > 10000,
that row shold be in RED color.
Please give me Example of code.
Poins will be awarded soon.
Thanks,
Rohan
08-20-2007 11:13 AM
Hi Nimesh,
Please checkout this sample code
http://www.geocities.com/mpioud/Z_ALV_LINE_COLOR.html
Also read page 28
of this document
Regards,
Aby
08-20-2007 11:35 AM
Hi,
Please see below postings
Example on ALV with cell color
http://www.geocities.com/mpioud/Z_ALV_CELL_COLOR.html
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
Regards,
ABY
Message was edited by:
Aby Jacob Emmanuel
08-20-2007 11:40 AM
This code could be helpfull.
TYPES: BEGIN OF types_vbrk,
vbeln TYPE vbeln_vf,
numki TYPE numki,
bukrs TYPE bukrs,
vkorg TYPE vkorg,
erdat TYPE erdat,
belnr TYPE belnr_d,
budat TYPE budat,
gjahr TYPE gjahr,
newki TYPE numki,
color TYPE char4,
END OF types_vbrk.
DATA: t_vbrk TYPE STANDARD TABLE OF types_vbrk.
............................
if .....
wa_vbrk-color = 'C611'.
endif.
append wa_vbrk to t_vbrk.
clear wa_vbrk.
wa_layout-info_fname = 'COLOR'.
** Pass the Layout either to ALV generating FM or Method the line with color will ** be displayed in that color.
Hope that Helps
Anirban M.
08-21-2007 11:17 AM
Hi,
Check this code,
type-pools slis.
data: fieldcat type slis_t_fieldcat_alv.
data: begin of imara occurs 0,
matnr type mara-matnr,
mtart type mara-mtart,
maktx type makt-maktx,
color_line(4) type c,
end of imara.
data: xcolor type slis_specialcol_alv.
START-OF-SELECTION.
PERFORM get_data.
PERFORM write_report.
************************************************************************
Get_Data
************************************************************************
FORM get_data.
imara-matnr = 'ABC'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for ABC'.
APPEND imara.
imara-matnr = 'DEF'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for DEF'.
APPEND imara.
imara-matnr = 'GHI'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for GHI'.
APPEND imara.
imara-matnr = 'JKL'.
imara-mtart = 'ZCFG'.
imara-maktx = 'This is description for JKL'.
APPEND imara.
DATA: color_code(1) TYPE n VALUE '1'.
data: color_line(4) type c.
LOOP AT imara.
AT NEW matnr.
CONCATENATE 'C' color_code '10' INTO color_line.
color_code = color_code + 1.
IF color_code = '8'.
color_code = '1'.
ENDIF.
ENDAT.
imara-color_line = color_line..
MODIFY imara.
ENDLOOP.
ENDFORM. "get_data
************************************************************************
WRITE_REPORT
************************************************************************
FORM write_report.
DATA: layout TYPE slis_layout_alv.
layout-info_fieldname = 'COLOR_LINE'.
PERFORM build_field_catalog.
CALL ABAP LIST VIEWER (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = layout
it_fieldcat = fieldcat
TABLES
t_outtab = imara.
ENDFORM. "write_report
************************************************************************
BUILD_FIELD_CATALOG
************************************************************************
FORM build_field_catalog.
DATA: fc_tmp TYPE slis_t_fieldcat_alv WITH HEADER LINE.
CLEAR: fieldcat. REFRESH: fieldcat.
CLEAR: fc_tmp.
fc_tmp-reptext_ddic = 'Material Number'.
fc_tmp-fieldname = 'MATNR'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '18'.
APPEND fc_tmp TO fieldcat.
CLEAR: fc_tmp.
fc_tmp-reptext_ddic = 'Material Type'.
fc_tmp-fieldname = 'MTART'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '4'.
APPEND fc_tmp TO fieldcat.
CLEAR: fc_tmp.
fc_tmp-reptext_ddic = 'Material'.
fc_tmp-fieldname = 'MAKTX'.
fc_tmp-tabname = 'IMARA'.
fc_tmp-outputlen = '40'.
APPEND fc_tmp TO fieldcat.
ENDFORM.
reward if helpful.
regards,
pritha.
08-22-2007 9:28 AM
Dear Nimesh Master
In stead of repeating the same question over and over maybe you could try to read the given usefull answers and solve your problem
Dirk.