08-08-2007 11:03 AM
Hi all,
One of my output field column in ALV contains values like..
qunty
10
20
30
10
i want to make the record colour yellow when it is 10.
how to do this.
pls help me..
vkr.
08-08-2007 11:13 AM
Hi VKR,
first: declare in your itab a field like this: CLR_L(4),
second: in layout do this GS_LAYOUT-INFO_FNAME = 'CLR_L'.
third: in filling the itab do this
Yellow = C300.
if qunty = 10. ITAB-CLR_L = 'C300'. else. clear ITAB-CLR_L. endif.
Hope it helps.
Regards, Dieter
08-08-2007 11:13 AM
Hi VKR,
first: declare in your itab a field like this: CLR_L(4),
second: in layout do this GS_LAYOUT-INFO_FNAME = 'CLR_L'.
third: in filling the itab do this
Yellow = C300.
if qunty = 10. ITAB-CLR_L = 'C300'. else. clear ITAB-CLR_L. endif.
Hope it helps.
Regards, Dieter
08-08-2007 11:34 AM
Hi VKR,
Please try this codes ..
REPORT yhnalvclr1.
TYPE-POOLS : slis.
DATA : BEGIN OF t5 OCCURS 0.
INCLUDE STRUCTURE t005t.
DATA : color(4) TYPE c, "Line
coltab TYPE slis_t_specialcol_alv,"Column/Font in Cell
target TYPE p,
END OF t5.
DATA cs_layo TYPE slis_layout_alv.
DATA fcat TYPE slis_t_fieldcat_alv.
DATA fcas TYPE slis_fieldcat_alv.
DATA scol TYPE slis_specialcol_alv.
DATA s5 LIKE t5.
DATA repid LIKE sy-repid.
DATA Selection
SELECT * INTO CORRESPONDING FIELDS OF TABLE t5 FROM t005t
WHERE spras = sy-langu
AND land1 LIKE 'A%'.
Build FieldCatalog
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T005T'
CHANGING
ct_fieldcat = fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
DELETE fcat WHERE fieldname = 'PRQ_SPREGT' OR fieldname = 'SPRAS'.
Setting Color fields
MOVE 'COLOR' TO cs_layo-info_fieldname.
MOVE 'COLTAB' TO cs_layo-coltab_fieldname.
Coloring Rows
LOOP AT t5 INTO s5 WHERE land1 = 'AU'.
s5-color = 'C510'.
MODIFY t5 FROM s5.
ENDLOOP.
Coloring cell
LOOP AT t5 WHERE land1 = 'AI'.
scol-fieldname = 'LANDX'.
scol-color-col = 1.
scol-color-int = 1.
scol-color-inv = 0.
APPEND scol TO t5-coltab.
MODIFY t5.
ENDLOOP.
Show ALV
repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repid
is_layout = cs_layo
it_fieldcat = fcat
TABLES
t_outtab = t5
EXCEPTIONS
program_error = 1
OTHERS = 2.
Regards,
Hendy