10-12-2013 9:45 AM
Hi All,
My requirement is in dynamic ALV ,cell color should change whenever the condition is met.
Reply ASAP.
10-12-2013 10:12 AM
Hello Neha,
There are no. of link available on Google for the same. Please try once on Google by "dynamic alv cell color abap" ..
One link i am sharing with you. for more info please search..
Individual cell coloring in dynamic alv - ABAP Development - SCN Wiki
one more: Please Avoid using the word Urgent or ASAP. Using these word is against the rule of SCN.
10-12-2013 10:07 AM
hi Neha
many links available by just searching google.
pasting one of them for your ref.
10-12-2013 10:12 AM
Hello Neha,
There are no. of link available on Google for the same. Please try once on Google by "dynamic alv cell color abap" ..
One link i am sharing with you. for more info please search..
Individual cell coloring in dynamic alv - ABAP Development - SCN Wiki
one more: Please Avoid using the word Urgent or ASAP. Using these word is against the rule of SCN.
10-12-2013 10:19 AM
Hi Neha ,
You can take a look on the Type-pools for Colour changing fields and all.
Also Pls go through this link.
https://scn.sap.com/thread/144178
Thanks,
Uday.
10-13-2013 8:44 AM
The color properties is determined by the color variable. Color variable is a four character variable.
color(4) type c.
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
color = 'C410'. By changing the second character, you can change the color.
1. To set the color for a field, add the field of type lvc_t_scol to the internal data table.
types: begin of ty_vbak,
vbeln type vbeln_va,
erdat type erdat,
ernam type ernam,
netwr type netwr_ak,
cell_color type lvc_t_scol,
end of ty_vbak.
DATA : I_data1 TYPE table of ty_vbak,
wa_data1 LIKE LINE OF i_data1.
2. After getting data into internal table, loop through the table, and set colors to the required columns for each row in the internal table.
data: ls_tabcolor type lvc_s_scol.
loop at i_data1 into wa_data1 where erdat LT '21010101'. " Condition for the color
clear ls_tabcolor.
ls_tabcolor-fname = 'VBELN'.
ls_tabcolor-color-col = 1. " Blue. " Color code
ls_tabcolor-color-int = 0. " Intensified
ls_tabcolor-color-inv = 0. " Inverse
append ls_tabcolor to wa_data1-cell_color.
modify i_data1 from wa_data1.
endloop.
Here the column VBELN will be colored blue only for those rows whose erdat is less that 01.01.2010. (The cells for coloring are thus selected dynamically. )
3. Declare the color field in the layout.
data : gd_layout1 TYPE lvc_s_layo.
gd_layout1-ctab_fname = 'CELL_COLOR'.
4. Call ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
is_layout_lvc = gd_layout1
it_fieldcat_lvc = gt_alv_fieldcat1
* I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
i_save = 'X'
TABLES
t_outtab = i_data1
EXCEPTIONS
program_error = 1
OTHERS = 2.
Note : There are seven color codes available.
1 gray-blue
2 light gray
3 yellow
4 blue-green
5 green
6 red
7 orange
10-13-2013 9:17 AM