09-22-2011 1:46 PM
Hi Master's.
I want to display a paticular row in my alv_grid based on my condition a diffrent colour.
The Entire row ?
Regards,
Abhisek
09-22-2011 1:54 PM
You can have a new field in your OUTPUT Table structure which is of 4 characters.
Lets say ROWCL is the field name.
While filling each row in your output table, you can also fill value for this field based on condition.
Contents of this field would be "CXYZ".
C - hardcode
X - 1,2,3,4,5,6,7 - Each number gives different color
Y - 1/0 - Intensified
Z - 1/0 - for some other property.
Now you have to mention this field name as the INFO field for the ALV GRID LAYOUT Structure.
GS_LAYOUT-info_fieldname = 'ROWCL'.
and pass this GS_LAYOUT to REUSE_ALV_GRID_DISPLAY.
Thanks,
Sai Ramesh P
09-22-2011 1:54 PM
You can have a new field in your OUTPUT Table structure which is of 4 characters.
Lets say ROWCL is the field name.
While filling each row in your output table, you can also fill value for this field based on condition.
Contents of this field would be "CXYZ".
C - hardcode
X - 1,2,3,4,5,6,7 - Each number gives different color
Y - 1/0 - Intensified
Z - 1/0 - for some other property.
Now you have to mention this field name as the INFO field for the ALV GRID LAYOUT Structure.
GS_LAYOUT-info_fieldname = 'ROWCL'.
and pass this GS_LAYOUT to REUSE_ALV_GRID_DISPLAY.
Thanks,
Sai Ramesh P
09-22-2011 2:12 PM
Hi Ramesh,
How about just one row based on the condition ?
Regards,
Abhisek.
09-22-2011 2:20 PM
Pass value (CXYZ) into ROWCL only for that particular row and dont pass anything to other rows.
Thanks
Sai Ramesh P
09-22-2011 2:28 PM
09-22-2011 2:07 PM
If you are using the SALV model you can use class
* Final output table
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE erdat,
auart TYPE auart,
kunnr TYPE kunnr,
t_color TYPE lvc_t_scol, " << for color
END OF ty_vbak.
DATA: t_vbak TYPE STANDARD TABLE OF ty_vbak.
DATA: lt_s_color TYPE lvc_t_scol,
ls_s_color TYPE lvc_s_scol.
ls_s_color-color-col = col_positive.
ls_s_color-color-int = 0.
ls_s_color-color-inv = 0.
APPEND ls_s_color TO lt_s_color.
CLEAR ls_s_color.
* Modify that data back to the output table
la_vbak-t_color = lt_s_color.
MODIFY ct_vbak FROM la_vbak.
CLEAR la_vbak.
You can check the entire code at: [SALV Table 9 u2013 Apply Colors|http://help-abap.zevolving.com/2008/10/salv-table-9-apply-colors/]
Regards,
Naimesh Patel