09-25-2006 7:20 PM
Hello there,
In the code below:
DATA: lv_key TYPE i.
format color lv_key intensified no-gap on.
I keep getting the error
<b>
"COLOR LV_KEY" is not expected; only 1 to 7 or the relevant color IDs
</b>
May I know is there anyway I could get around that? Unfortunately I can not hard-code the color in this case.
Thanks a lot!
Regards,
Anyi
09-25-2006 7:24 PM
09-25-2006 7:22 PM
Hi,
Please chcek this link for sample code.
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba1ae35c111d1829f0000e829fbfe/content.htm
Regards,
Ferry Lianto
09-25-2006 7:22 PM
Hi,
The options COLOR, INTENSIFIED, and INVERSE of the FORMATstatement influence the colors of the output list.
To set colors in the program, use:
Syntax
<b>FORMAT COLOR n [ON] INTENSIFIED [ON|OFF] INVERSE [ON|OFF].</b>
To set colors at runtime, use:
Syntax
<b>FORMAT COLOR = c INTENSIFIED = int INVERSE = inv.</b>
for this runtime, you can decalre the variables and use your algorithams and pass when you are writing FORMAT COLOR statment
Regards
Sudheer
Message was edited by: Sudheer Junnuthula
09-25-2006 7:24 PM
09-25-2006 7:29 PM
Hello Rich,
Thanks for your reply.
Unfortunately this lv_key stands for the local variable color which is initialized through some other algorithms. Therefore I can not assign lv_key as a constant.
Any other suggestions?
Regards,
Anyi
09-25-2006 7:39 PM
09-25-2006 7:27 PM
Hi Anyi,
You can only specify a VALUE or COLOR CODE to COLOR attribute.
So try with this logic.
Use CASE...ENDCASE statements to resolve this issue.
CASS LV_KEY.
WHEN '1'.
FORMAT COLOR 1 INTENSIFIED ON.
WHEN '2'.
FORMAT COLOR 2 INTENSIFIED ON.
.....
WHEN '7'.
FORMAT COLOR 7 INTENSIFIED ON.
ENDCASE.
Thanks,
Vinay
09-25-2006 7:31 PM
Hi Anyi,
Did you check sample program from above link?
REPORT demo_list_format_color_1.
DATA lv_key TYPE i.
DATA col(15) TYPE c.
...
WHILE lv_key < 8.
CASE lv_key.
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) lv_key, AT 7 sy-vline,
col, sy-vline,
col INTENSIFIED OFF, sy-vline,
col INVERSE.
i = i + 1.
ENDWHILE.
Regards,
Ferry Lianto