Using color variables in WRITE statement

tomas.teicher picture tomas.teicher · Apr 22, 2013 · Viewed 8.9k times · Source

How can I use color value variable? For example, this works for me:

write:/10  'test' COLOR COL_HEADING.

I thoght that colours are integers so I tried:

data:
gv_mycolor type I.
gv_mycolor = 5.
write:/10  'test' COLOR gv_mycolor.

the second code gives me an error: "Color gv_mycolor is not expected; only 1 to 7 or the relevant color IDs are allowed. Statement

FORMAT COLOR = gv_mycolor.

works for me, I have problem just with write statement.

Can anybody help?

Answer

vlad-ardelean picture vlad-ardelean · Apr 24, 2013
DATA colour TYPE i VALUE 2.

WRITE:/10  'test' COLOR = colour .

You MUST use an equal sign, and that's all there is to it... ABAP and it's funny statements :P