‎2010 Dec 06 3:54 PM
i am using cell color in alv
types: begin of ty_tab,
color(3),
cell type slis_t_specialcol_alv, "deep str with fld: 'fieldname','color','nokeycol'*
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
.....
.....
end of ty_tab,
typ_tab type standard table of ty_tab.
data: itab type typ_tab,
wa type ty_tab.
now if i write: loop at itab into wa.
wa-cell-fieldname = 'matnr'.
wa-cell-color-col = 2. "color is a deep str with fld 'col'/'inv'/'int'.**
wa-cell-nokeycol = 'x'.
modify itab from wa transporting cell.
endloop.
i am getting an error that 'cell' is not a part of 'wa'.
pls suggest how to do the cell coloring?
i want to do it with 'types' declaration , not with occurs 0.
‎2010 Dec 06 5:42 PM
I think you may need to append the deeper table:
instead of modify itab from wa transporting cell.
wa-fieldname = 'POINTS'.
wa-color-col = 5.
APPEND wa TO itab-cell.
Edited by: Ron Mulig on Dec 6, 2010 6:49 PM
‎2010 Dec 07 9:53 AM
Hi,
Please refer this link for coloring row.
http://wiki.sdn.sap.com/wiki/display/Snippets/ColoringaRowinanALVconditionally
Regards,
Vijeta
‎2010 Dec 07 12:56 PM
now if i write: loop at itab into wa.
wa-cell-fieldname = 'matnr'.
wa-cell-color-col = 2. "color is a deep str with fld 'col'/'inv'/'int'.**
wa-cell-nokeycol = 'x'.
modify itab from wa transporting cell.
endloop.I guess your work area name is wa_cell, if it is so
you need to write above as:
now if i write:
loop at itab into wa_cell.
wa_cell-fieldname = 'matnr'.
wa_cell-color_col = 2. "color is a deep str with fld 'col'/'inv'/'int'.
wa_cell-nokeycol = 'x'.
modify itab from wa_cell transporting fieldname color_col nokeycol.
endloop.
Be careful with _ and - , as - means you are accessing a component of.
Regards,
Dep
‎2010 Dec 09 1:20 PM
thnx for ur reply
no the work area name is 'wa'. cell is a fld. type slis_t_specialcol_alv.
‎2010 Dec 09 5:49 PM
I use color in SALV, but it's same concept...put the values into a structure, append that to a table. Then set the color column in your output = the color table, like:
data: gs_color type lvc_s_scol,
gt_color type lvc_t_scol,
. . .
gs_color-color-col = 5.
gs_color-color-int = 0.
gs_color-color-inv = 0.
. . .
append gs_color to gt_color.
<output table>-color = gt_color.
clear: gt_color, gs_color.
‎2010 Dec 13 4:19 AM
Hi Surajit,
You have declared itab as a structure.Please declare it as a table.
‎2010 Dec 13 9:06 AM
Hi,
To color a cell in ALV Grid layout format you can try with this piece code according to your program..
data:
t_fieldcatalog type slis_t_fieldcat_alv,
fs_fieldcatalog like line of t_fieldcatalog,
** Building the field catalog.........*
perform build_fieldcatalog.
Form build_fieldcatalog.
fs_fieldcatalog-fieldname = '<fieldname1>'.
fs_fieldcatalog-seltext_m = '<Short Text of field1>''.
fs_fieldcatalog-col_pos = 1.
fs_fieldcatalog-outputlen = 10.
fs_fieldcatalog-emphasize = 'C100'. " color code
append fs_fieldcatalog to t_fieldcatalog.
clear fs_fieldcatalog.
fs_fieldcatalog-fieldname = '<fieldname2>'.
fs_fieldcatalog-seltext_m = '<Short Text of field2>''.
fs_fieldcatalog-col_pos = 2.
fs_fieldcatalog-outputlen = 10.
fs_fieldcatalog-emphasize = 'C300'. " color code
append fs_fieldcatalog to t_fieldcatalog.
clear fs_fieldcatalog.
ENDFORM.
Hope this code will resolve your problem.
Regards,
Suvajit.
‎2010 Dec 13 9:15 AM
Hi,
you have declared wa as an internal table without header line. You can't fill the columns directly without a work area!
Regards.
Klaus
‎2010 Dec 13 12:38 PM
Hai,
You need to append this way:
Declare a Work area for the Color Table 'Cell'.
Data:
wa_cell type slis_specialcol_alv.
Loop at itab into wa.
wa_cell-fieldname = ''
wa_cell-color-col = ''
wa_cell-nokeycol = ''
append wa_cell to wa-cell.
Modify itab from wa.
Endloop.Best Regards,
rama
‎2010 Dec 13 1:17 PM
Hi,
As suggested already, this is the way.
Declare internal table for color.
Data : color TYPE lvc_s_scol. "For cell color
clear color.
color-fname = 'MATNR'. "Should be in capital letter
color-col = '5'.
color-int = '1'.
color-inv = '1'.
APPEND color TO wa-color.
MODIFY itab FROM wa INDEX 7 TRANSPORTING color.
‎2010 Dec 19 2:26 PM
Hi,
Cell coloring for declare type as cell_colour TYPE lvc_s_scol " for cell colour
and declare as type TYPE-POOLS: slis. "ALV Declarations
In type- pools : slis, cell_colour type is there.
You want more clarification then follow this link. cell color alv program is there.
http://www.sap-basis-abap.com/abap/color-a-column-value-in-alv-report.htm
I hope it helps for u.
Edited by: chandrasek on Dec 19, 2010 3:27 PM
‎2010 Dec 21 8:20 PM
Hi saurajit,
"alv problem" is no very good subject,...
in your definition
types: begin of ty_tab,
color(3),
cell type slis_t_specialcol_alv, "deep str with fld: 'fieldname','color','nokeycol'*
vbeln type vbap-vbeln,
posnr type vbap-posnr,
matnr type vbap-matnr,
.....
.....
end of ty_tab,slis_t_specialcol_alv is an internal table without header line.
You could have copied the error message you got. It was not "'cell' is not a part of 'wa'."
To change only what is required, do like this
field-symbols:
<cell_row> type line of slis_t_specialcol_alv,
loop at itab into wa.
append initial line to wa-cell assigning <cell_row>,
<cell_row>-fieldname = 'MATNR'."Use upper case
<cell_row>-color-col = cl_gui_resources=>list_col_total. "This is yellow, use cl_gui_resources=> constants
<cell_row>-nokeycol = 'X'.
modify itab from wa transporting cell.
endloop.Regards,
Clemens