Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV OO

Former Member
0 Likes
813

Hi people!

I'm doing an ALV OO (with CL_GUI_ALV_GRID) and I need to color only determinated fields in grid! I know how to set color of a row and of a column too.... but I don't know what I need!

Can Anyone help me???????

Tks in advance!

Gabriel

Edited by: Gabriel Petrini on Jan 30, 2008 11:33 AM

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
614

Extract from [ALV Gird Control (BC-SRV-ALE)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]

Coloring Cells
Purpose
You can change the color of cells in the grid control to highlight data in the list. Although you can also use this process to color entire rows, this is much more time-consuming than the procedure described in Coloring Rows [Page 31].
The D&D Behavior for Special Rows/Cells [Page 27] process is the analogous
method to the method for selecting cells.
Process Flow
1. Define the layout structure [Page 157] of type LVC_S_LAYO.
2. Add a color table of type LVC_T_SCOL to your output table, as shown in the example below:
DATA: BEGIN OF GT_OUTTAB OCCURS 0.
INCLUDE STRUCTURE <DDIC-Struktur>.
DATA: CT TYPE LVC_T_SCOL. "Table for colors
DATA: END OF GT_OUTTAB.
3. Select your data and copy it into the output table.
4. Read one row of the output table at a time in the loop. One row of the color table has three
fields. If field NOKEYCOL is set, you can change the color of key fields. Assign values to the remaining fields as follows:
__ If you want to color the entire row, assign the corresponding values to the fields of structure COLOR. Field fname does not receive a value in this case.
__ If you want to color specific columns of the row only, you must append one row for each column to the color table. Assign the name of the desired column to field fname, and the corresponding values to the fields of structure COLOR.
For information on the meaning of the color settings, see F1 help on the format
command. Class CL_GUI_RESOURCES contains constant attributes for fields INT and INV of structure COLOR.
5. Assign the name of the internal table to field CTAB_FNAME of the layout structure (in our case'CT', see step 2).
6. Pass the layout structure and the output table with method  set_table_for_first_display [Page 100].
If you do not want to color the cells for the first display, postpone step 4 and refresh
your output table with method refresh_table_display [Page 85].

Regards

Hi people!

I'm doing an ALV OO (with CL_GUI_ALV_GRID) and I need to color only determinated fields in grid! I know how to set color of a row and of a column too.... but I don't know what I need!

Can Anyone help me???????

Tks in advance!

Gabriel

Edited by: Gabriel Petrini on Jan 30, 2008 11:33 AM

2 REPLIES 2
Read only

Former Member
0 Likes
614

Hi,

PLease refer to the standard program

BCALV_DEMO_TOOLTIP

.

Please refer to the link below it may be helpful.

http://www.saptechnical.com/Tutorials/ALV/cell/highlight.htm

Thanks,

Sriram Ponna.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
615

Extract from [ALV Gird Control (BC-SRV-ALE)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]

Coloring Cells
Purpose
You can change the color of cells in the grid control to highlight data in the list. Although you can also use this process to color entire rows, this is much more time-consuming than the procedure described in Coloring Rows [Page 31].
The D&D Behavior for Special Rows/Cells [Page 27] process is the analogous
method to the method for selecting cells.
Process Flow
1. Define the layout structure [Page 157] of type LVC_S_LAYO.
2. Add a color table of type LVC_T_SCOL to your output table, as shown in the example below:
DATA: BEGIN OF GT_OUTTAB OCCURS 0.
INCLUDE STRUCTURE <DDIC-Struktur>.
DATA: CT TYPE LVC_T_SCOL. "Table for colors
DATA: END OF GT_OUTTAB.
3. Select your data and copy it into the output table.
4. Read one row of the output table at a time in the loop. One row of the color table has three
fields. If field NOKEYCOL is set, you can change the color of key fields. Assign values to the remaining fields as follows:
__ If you want to color the entire row, assign the corresponding values to the fields of structure COLOR. Field fname does not receive a value in this case.
__ If you want to color specific columns of the row only, you must append one row for each column to the color table. Assign the name of the desired column to field fname, and the corresponding values to the fields of structure COLOR.
For information on the meaning of the color settings, see F1 help on the format
command. Class CL_GUI_RESOURCES contains constant attributes for fields INT and INV of structure COLOR.
5. Assign the name of the internal table to field CTAB_FNAME of the layout structure (in our case'CT', see step 2).
6. Pass the layout structure and the output table with method  set_table_for_first_display [Page 100].
If you do not want to color the cells for the first display, postpone step 4 and refresh
your output table with method refresh_table_display [Page 85].

Regards