Application Development 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: 

Different colors appearing at alternate lines of output

Former Member
0 Kudos

Hello everyone,

I want to know how do i make every alternate lines generated by my report to have different colors to make it easier for the users to view?

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

For color change of alternate lines

data: line_check type i.

LINE_CHECK = 0.

LOOP AT I_BLARTNIV.

  • write keyfiled with keyfield color

WRITE: I_BLARTNIV-BLART COLOR COL_KEY.

  • Swap colors for each line

IF LINE_CHECK = 0.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

LINE_CHECK = 1.

ELSE.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

LINE_CHECK = 0.

ENDIF.

  • Write line

WRITE: / I_BLARTNIV-BILAGS_COUNTER.

ENDLOOP.

5 REPLIES 5

Former Member
0 Kudos

REPORT demo_list_format_color_2 NO STANDARD PAGE HEADING LINE-SIZE 70.

TABLES: spfli, sflight.

DATA sum TYPE i.

TOP-OF-PAGE.

WRITE 'List of Flights' COLOR COL_HEADING.

ULINE.

GET spfli.

FORMAT COLOR COL_HEADING.

WRITE: 'CARRID', 10 'CONNID', 20 'FROM', 40 'TO'.

FORMAT COLOR COL_KEY.

WRITE: / spfli-carrid UNDER 'CARRID',

spfli-connid UNDER 'CONNID',

spfli-cityfrom UNDER 'FROM',

spfli-cityto UNDER 'TO'.

ULINE.

FORMAT COLOR COL_HEADING.

WRITE: 'Date', 20 'Seats Occupied', 50 'Seats Available'.

ULINE.

sum = 0.

GET sflight.

IF sflight-seatsocc LE 10.

FORMAT COLOR COL_NEGATIVE.

ELSE.

FORMAT COLOR COL_NORMAL.

ENDIF.

WRITE: sflight-fldate UNDER 'Date',

sflight-seatsocc UNDER 'Seats Occupied',

sflight-seatsmax UNDER 'Seats Available'.

sum = sum + sflight-seatsocc.

GET spfli LATE.

ULINE.

WRITE: 'Total Bookings: ' INTENSIFIED OFF,

sum COLOR COL_TOTAL.

ULINE.

SKIP.

see below linke for more info

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba1ae35c111d1829f0000e829fbfe/content.htm

Former Member
0 Kudos

HI,

For color change of alternate lines

data: line_check type i.

LINE_CHECK = 0.

LOOP AT I_BLARTNIV.

  • write keyfiled with keyfield color

WRITE: I_BLARTNIV-BLART COLOR COL_KEY.

  • Swap colors for each line

IF LINE_CHECK = 0.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

LINE_CHECK = 1.

ELSE.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

LINE_CHECK = 0.

ENDIF.

  • Write line

WRITE: / I_BLARTNIV-BILAGS_COUNTER.

ENDLOOP.

Former Member
0 Kudos

Bernard,

Are you talking about a classical report or a ALV report?

If ALV, then just the ZEBRA parameter in the layout to 'X'.

Regards,

Ravi

Note : Please reward the posts that help you.

0 Kudos

I was talking about traditional report and i solved it based on what an earlier post mentioned. However, your info for ALV reports will help me in future.

Thank you

Former Member
0 Kudos

use the format color stmt.

FORMAT COLOR = <c>.

if c= 0 to 7.

0 means color off

1 to 7 will display gray-blue light gray yellow blue-green

green red violet respecctivetly..

displaying different color:

sample:

data: c type i value 0, d type i.

do 16 times.

FORMAT COLOR = d.

d = c mod 8.

write:/ 'use ur loop and this logic'.

c = c + 1.

enddo.

Hi i checked this logic its working for me.

Get back 4 more help.

Regards

vijay