Application Development and Automation 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: 
Read only

reports

Former Member
0 Likes
679

hello experts,

in reports i want to display the two boxes with column heading in color..

and inside of that box i want to display some details...send me some sample programs.....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
648

Hi,

see the following code:

1. Include a 4-character field in the internal data table that is being passed to REUSE_ALV_GRID_DISPLAY.

Eg: DATA: BEGIN OF i_data OCCURS 10,

qmnum LIKE viqmel-qmnum,

qmart LIKE viqmel-qmart,

zzvalstat LIKE viqmel-zzvalstat,

valstattxt LIKE zawprcode-valstattxt,

kunum LIKE viqmel-kunum,

bstnk LIKE viqmel-bstnk,

qmtxt LIKE viqmel-qmtxt,

ws_color(4)TYPE c,

END OF i_data.

2. In the code, loop through the lines of the internal table and assign values to this field. The 4-character value will be of the format - Cxyz.

Char 1 – is always C indicating that it’s a color property.

Char 2 (x) – color code, which can be any value from (1 – 7).

Char 3 (y) – Intensity on/off. (1 = on, 0 = off).

Char 4 (z) – Inverse display on/off. (1 = on, 0 = off).

(From the above, it is clear that we can have only 28 different coloring options)

Eg: C401.

LOOP AT i_data.

IF (expression 1).

i_data-ws_color = ‘C510’.

ELSEIF(expression 2).

i_data-ws_color = ‘C200’.

ELSE.

i_data-ws_color = ‘C711’.

ENDIF.

MODIFY i_data.

ENDLOOP.

3. When specifying the layout properties, specify the name of this field (ws_color) as the color field.

FORM f1200_define_layout CHANGING p_i_layout TYPE slis_layout_alv.

CLEAR p_i_layout.

p_i_layout-zebra = 'X'.

p_i_layout-colwidth_optimize = 'X'.

p_i_layout-info_fieldname = 'WS_COLOR'.

ENDFORM. " F1200_define_layout

Example:

Shown below is screen dump with 14 coloring options. You could try out the rest 14!!

Code:

LOOP AT i_data.

cnt = cnt + 1.

IF cnt = 1.

i_data-ws_color = 'C110'.

ELSEIF cnt = 2.

i_data-ws_color = 'C210'.

ELSEIF cnt = 3.

i_data-ws_color = 'C310'.

ELSEIF cnt = 4.

i_data-ws_color = 'C410'.

ELSEIF cnt = 5.

i_data-ws_color = 'C510'.

ELSEIF cnt = 6.

i_data-ws_color = 'C610'.

ELSEIF cnt = 7.

i_data-ws_color = 'C710'.

reward points if helpful

Regards

Srikanta Gope

3 REPLIES 3
Read only

Former Member
0 Likes
649

Hi,

see the following code:

1. Include a 4-character field in the internal data table that is being passed to REUSE_ALV_GRID_DISPLAY.

Eg: DATA: BEGIN OF i_data OCCURS 10,

qmnum LIKE viqmel-qmnum,

qmart LIKE viqmel-qmart,

zzvalstat LIKE viqmel-zzvalstat,

valstattxt LIKE zawprcode-valstattxt,

kunum LIKE viqmel-kunum,

bstnk LIKE viqmel-bstnk,

qmtxt LIKE viqmel-qmtxt,

ws_color(4)TYPE c,

END OF i_data.

2. In the code, loop through the lines of the internal table and assign values to this field. The 4-character value will be of the format - Cxyz.

Char 1 – is always C indicating that it’s a color property.

Char 2 (x) – color code, which can be any value from (1 – 7).

Char 3 (y) – Intensity on/off. (1 = on, 0 = off).

Char 4 (z) – Inverse display on/off. (1 = on, 0 = off).

(From the above, it is clear that we can have only 28 different coloring options)

Eg: C401.

LOOP AT i_data.

IF (expression 1).

i_data-ws_color = ‘C510’.

ELSEIF(expression 2).

i_data-ws_color = ‘C200’.

ELSE.

i_data-ws_color = ‘C711’.

ENDIF.

MODIFY i_data.

ENDLOOP.

3. When specifying the layout properties, specify the name of this field (ws_color) as the color field.

FORM f1200_define_layout CHANGING p_i_layout TYPE slis_layout_alv.

CLEAR p_i_layout.

p_i_layout-zebra = 'X'.

p_i_layout-colwidth_optimize = 'X'.

p_i_layout-info_fieldname = 'WS_COLOR'.

ENDFORM. " F1200_define_layout

Example:

Shown below is screen dump with 14 coloring options. You could try out the rest 14!!

Code:

LOOP AT i_data.

cnt = cnt + 1.

IF cnt = 1.

i_data-ws_color = 'C110'.

ELSEIF cnt = 2.

i_data-ws_color = 'C210'.

ELSEIF cnt = 3.

i_data-ws_color = 'C310'.

ELSEIF cnt = 4.

i_data-ws_color = 'C410'.

ELSEIF cnt = 5.

i_data-ws_color = 'C510'.

ELSEIF cnt = 6.

i_data-ws_color = 'C610'.

ELSEIF cnt = 7.

i_data-ws_color = 'C710'.

reward points if helpful

Regards

Srikanta Gope

Read only

Former Member
0 Likes
648

Look at the following programs to draw lines, corners, boxes etc:

demo_list_special_lines

demo_list_grid.

demo_list_crosses

demo_list_edges

demo_list_t_pieces

Regards,

Ravi

Read only

Former Member
0 Likes
648

Hi

DATA: BEGIN OF BOX,
       1(20) TYPE C,
       2(20) TYPE C,
      END   OF BOX.

START-OF-SELECTION.

  BOX-1 = 'Title 1'.
  BOX-2 = 'title 2'.

  WRITE: / SY-ULINE(43),
         / SY-VLINE NO-GAP, BOX-1 COLOR COL_HEADING NO-GAP,
           SY-VLINE NO-GAP, BOX-2 COLOR COL_HEADING NO-GAP, SY-VLINE,
         / SY-ULINE(43).

  BOX-1 = 'Hello'.
  BOX-2 = 'Bye bye'.

  WRITE:/ SY-VLINE NO-GAP, BOX-1 NO-GAP,
          SY-VLINE NO-GAP, BOX-2 NO-GAP, SY-VLINE,
        / SY-ULINE(43).

Max