2007 Jul 06 10:36 AM
Hi. I try to do sth like that
LOOP AT itab.
IF itab-belnr1 = itab-belnr2.
c = 5.
ELSE.
c = 4.
ENDIF.
WRITE: / sy-vline,
(10) itab-belnr1 COLOR c,
(10) itab-datum1 ,
sy-vline,
(10) itab-belnr2 ,
(10) itab-datum2 .
ENDLOOP.
But I receive <i>"COLOR 'c'" is not expected; only 1 to 7 or the relevant color IDs
(COL_...) are allowed.</i> . How to determine colors during program flow? Greetings. P.
2007 Jul 06 10:45 AM
Hi
the Command COLOR doesn't accept any variables along with it
It is a must to use the numbers 1 to 7 along with it.
Reward points for useful Answers
Regards
Anji
Hi
the Command COLOR doesn't accept any variables along with it
It is a must to use the numbers 1 to 7 along with it.
Reward points for useful Answers
Regards
Anji
2007 Jul 06 10:42 AM
hi,
U need to give as
COLOR 6.
U should give numbers after giving color.
0 COL_BACKGROUND
1 COL_HEADING
2 COL_NORMAL
3 COL_TOTAL
4 COL_KEY
5 COL_POSITIVE
6 COL_NEGATIVE
7 COL_GROUP
Message was edited by:
Roja Velagapudi
2007 Jul 06 10:43 AM
Hi,
Check this,
DATA col TYPE i VALUE 0.
DO 8 TIMES.
col = sy-index - 1.
FORMAT COLOR = col.
WRITE: / col COLOR OFF,
'INTENSIFIED ON' INTENSIFIED ON,
'INTENSIFIED OFF' INTENSIFIED OFF,
'INVERSE ON' INVERSE ON.
ENDDO.
Reward if useful!
2007 Jul 06 10:45 AM
Hi
the Command COLOR doesn't accept any variables along with it
It is a must to use the numbers 1 to 7 along with it.
Reward points for useful Answers
Regards
Anji
2007 Jul 06 10:45 AM
hi,
plz check if "c" the variable used is defined as integer and not as type N.
kiran.
2007 Jul 06 10:47 AM
You need to remember the color codes. Here is the list
Just mention the number beside the statement COLOR.
0 COL_BACKGROUND
1 COL_HEADING
2 COL_NORMAL
3 COL_TOTAL
4 COL_KEY
5 COL_POSITIVE
6 COL_NEGATIVE
7 COL_GROUP
Regards,
Pavan P.
2007 Jul 06 10:49 AM
REPORT ychatest.
DATA : itab TYPE TABLE OF mara WITH HEADER LINE.
data : c type i.
LOOP AT itab.
IF itab-matnr = itab-matnr.
c = 5.
ELSE.
c = 4.
ENDIF.
WRITE: / sy-vline.
<b>format color = c.</b>
write: (10) itab-matnr.
<b>format color off.</b>
WRITE: (10) itab-matnr ,
sy-vline,
(10) itab-matnr ,
(10) itab-matnr .
ENDLOOP.
2007 Jul 06 10:51 AM
Example 1 :
DATA col TYPE i VALUE 0.
DO 8 TIMES.
col = sy-index - 1.
FORMAT COLOR = col.
WRITE: / col COLOR OFF,
'INTENSIFIED ON' INTENSIFIED ON,
'INTENSIFIED OFF' INTENSIFIED OFF,
'INVERSE ON' INVERSE ON.
ENDDO.[/code] Example 2
IF SUIT = 'D' OR SUIT = 'H'.
WRITE: PILE_SUIT NO-GAP COLOR 6 INTENSIFIED INVERSE HOTSPOT,
PILE_CARD COLOR 6 INTENSIFIED INVERSE HOTSPOT.
ELSE.
WRITE: PILE_SUIT NO-GAP COLOR OFF INTENSIFIED OFF HOTSPOT,
PILE_CARD COLOR OFF INTENSIFIED OFF HOTSPOT.
ENDIF.reward points if it is usefull
Girish
2007 Jul 06 11:07 AM
LOOP AT itab.
IF itab-belnr1 = itab-belnr2.
c = 5.
ELSE.
c = 4.
ENDIF.
WRITE: / sy-vline.
format color = c.
write (10) itab-belnr1.
format color off.
write: (10) itab-datum1 ,
sy-vline,
(10) itab-belnr2 ,
(10) itab-datum2 .
ENDLOOP.
Message was edited by:
Tripat Pal Singh
2007 Jul 06 11:09 AM
HI.
We cant give variable or char instead of number (from 1 to 7),but we can pass value by variables.
check this code ,it will help you.
Check this,
DATA col TYPE i VALUE 0.
DO 8 TIMES.
col = sy-index - 1.
FORMAT COLOR = col.
WRITE: / col COLOR OFF,
'INTENSIFIED ON' INTENSIFIED ON,
'INTENSIFIED OFF' INTENSIFIED OFF,
'INVERSE ON' INVERSE ON.
ENDDO.
Reward all helpfull answers.
Regards.
Jay
2007 Jul 06 11:18 AM
hI piotr,
U should assigne values to 'c' betweeen 1-7 because there are 7 colors in abap directory.
1-Bluish
2-light gray
3-yellow
4-Dark grey
5-green
6-red
7-golden
U should use only these colors.
I think ur problem is solved.
Thanks
Sanket.
2007 Jul 06 11:22 AM
hi,
The options COLOR of the FORMAT statement influence the colors of the output list.
To set colors in the program, use:
Syntax
FORMAT COLOR <n>.
<b>To set colors at runtime, use:</b>
Syntax
<b>FORMAT COLOR = <c>.</b>
These formatting options do not apply to horizontal lines created by ULINE. They have the following functions:
COLOR sets the color of the line background.
For <n> you can set either a color number or a color specification. Instead of color number 0, however, you must use OFF.
If you set the color numbers at runtime, all values of <c> that are less than zero or greater than seven, lead to undefined results. The following table summarizes the different possibilities:
analyse the sample program, it will solve your problem.
REPORT demo_list_format_color_1.
DATA i TYPE i VALUE 0.
DATA col(15) TYPE c.
WHILE i < 8.
CASE i.
WHEN 0. col = 'COL_BACKGROUND '.
WHEN 1. col = 'COL_HEADING '.
WHEN 2. col = 'COL_NORMAL '.
WHEN 3. col = 'COL_TOTAL '.
WHEN 4. col = 'COL_KEY '.
WHEN 5. col = 'COL_POSITIVE '.
WHEN 6. col = 'COL_NEGATIVE '.
WHEN 7. col = 'COL_GROUP '.
ENDCASE.
FORMAT INTENSIFIED COLOR = i.
WRITE: /(4) i, AT 7 sy-vline,
col, sy-vline,
col INTENSIFIED OFF, sy-vline,
col INVERSE.
i = i + 1.
ENDWHILE.In the FORMAT statement, the COLOR option for the subsequent WRITE statements is set at runtime. The other options are set individually for each WRITE statement in the program.
regards,
Ashok Reddy
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |