Sunteți pe pagina 1din 3

02/02/12 SAP Community Network Wiki - Code Gallery - Displaying all possible colors in Classical Reports (

1/3 wiki.sdn.sap.com/wiki/display//Displaying+all+possible+colors+in+Classical+Reports+%28Lists%29
Log In Register About Us How to Contribute Store
Welcome Guest
SDN Community BPX Community Business Analytics University Alliances SAP EcoHub
Home Forums Wiki Blogs Articles eLearning Downloads Code Exchange Career Center Events InnoCentive Idea Place
Added by Venkat Appikonda, last edited by Ravi A on May 20, 2011
Displaying all possible colors in Classical Reports (Lists)
Color-related keywords for WRITE and FORMAT statements:
[COLOR {{{color [ON]}|OFF}|{= numericvariable}}]
[INTENSIFIED [{ON|OFF}|{= flag}]]
[INVERSE [{ON|OFF}|{= flag}]]
where color may be either a constant (COL_BACKGROUND, COL_HEADING, COL_NORMAL, COL_TOTAL, COL_KEY, COL_POSITIVE, COL_NEGATIVE, COL_GROUP) or a numeric value
(respectively 0 to 7).
The following colors are the approximate HTML rendering of an ABAP list when the SAPGUI theme uses this background color:
color number with INTENSIFIED ON with INTENSIFIED OFF with INVERSE ON color according to SAP documentation (real color as seen)
0 COL_BACKGROUND COL_BACKGROUND COL_BACKGROUND GUI-specific
1 COL_HEADING COL_HEADING COL_HEADING Gray-blue (blue sky)
2 COL_NORMAL COL_NORMAL COL_NORMAL Light gray (light cyan)
3 COL_TOTAL COL_TOTAL COL_TOTAL Yellow
4 COL_KEY COL_KEY COL_KEY Blue-green (between light cyan and blue sky)
5 COL_POSITIVE COL_POSITIVE COL_POSITIVE Green
6 COL_NEGATIVE COL_NEGATIVE COL_NEGATIVE Red
7 COL_GROUP COL_GROUP COL_GROUP Violet (orange)
The following list is obtained by using the program below:
REPORT zcolor.
DATA: BEGIN OF tp OCCURS 10,
id TYPE char1,
nr TYPE char8,
text TYPE char255,
END OF tp.
DATA: length TYPE i VALUE 8, " Length of list
teststring(15) TYPE c VALUE '012345678901234',
width TYPE i. " Width of list
02/02/12 SAP Community Network Wiki - Code Gallery - Displaying all possible colors in Classical Reports (
2/3 wiki.sdn.sap.com/wiki/display//Displaying+all+possible+colors+in+Classical+Reports+%28Lists%29
START-OF-SELECTION.
PERFORM heading.
PERFORM output_body.
*&---------------------------------------------------------------------*
*& Form HEADING
*----------------------------------------------------------------------*
FORM heading.
FORMAT INTENSIFIED OFF. " Remove any INTENSIFIED
ULINE AT (width). " Upper frame border
FORMAT COLOR COL_HEADING INTENSIFIED." Title color
WRITE: / sy-vline. " Left border
WRITE: 'No |Colour |intensified |intensified off|',
'inverse ' NO-GAP.
WRITE: AT width sy-vline. " Right border
ULINE AT (width). " Line below titles
FORMAT COLOR OFF.
ENDFORM. "HEADING
*&---------------------------------------------------------------------*
*& Form OUTPUT_BODY
*----------------------------------------------------------------------*
FORM output_body.
DO length TIMES.
PERFORM write_line USING sy-index.
ENDDO.
ENDFORM. "OUTPUT_BODY
*&---------------------------------------------------------------------*
*& Form WRITE_LINE
*----------------------------------------------------------------------*
FORM write_line USING count TYPE i.
DATA: help(14) TYPE c,
count1 TYPE i.
count1 = sy-index - 1.
WRITE: / sy-vline NO-GAP.
WRITE: (4) count1 COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: sy-vline NO-GAP.
CASE count1.
WHEN '0'.
help = 'COL_BACKGROUND'.
WHEN '1'.
help = 'COL_HEADING'.
WHEN '2'.
help = 'COL_NORMAL'.
WHEN '3'.
help = 'COL_TOTAL'.
WHEN '4'.
help = 'COL_KEY'.
WHEN '5'.
help = 'COL_POSITIVE'.
WHEN '6'.
help = 'COL_NEGATIVE'.
WHEN '7'.
help = 'COL_GROUP'.
ENDCASE.
WRITE: help COLOR COL_KEY INTENSIFIED NO-GAP.
WRITE: sy-vline NO-GAP.
WRITE: teststring COLOR = count1 INTENSIFIED NO-GAP.
WRITE: sy-vline NO-GAP.
WRITE: teststring COLOR = count1 INTENSIFIED OFF NO-GAP.
WRITE: sy-vline NO-GAP.
WRITE: teststring COLOR = count1 INVERSE NO-GAP.
WRITE AT width sy-vline NO-GAP.
ENDFORM. "WRITE_LINE
*-- End of Program
Labels
Contact Us Site Index Marketing Opportunities Legal Terms Privacy Impressum
abaplist
02/02/12 SAP Community Network Wiki - Code Gallery - Displaying all possible colors in Classical Reports (
3/3 wiki.sdn.sap.com/wiki/display//Displaying+all+possible+colors+in+Classical+Reports+%28Lists%29
Powered by SAP NetWeaver

S-ar putea să vă placă și