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: 

creating an ALV report using factory method

Former Member
0 Kudos

hi

I am creating an ALV report using factory method.

my report is based on itab which contain 3 coulms, 1 column is ERROR_TYPE . how can i color all the rows which contain E in error_type ???

thanks

Ami

3 REPLIES 3

former_member194669
Active Contributor
0 Kudos

In ALV Object Moldel using CL_SALV_COLUMNS_TABLE you cannot color a row.

Former Member
0 Kudos
  • color constants

TYPE-POOLS: col.

  • Type for row of internal table

TYPES: BEGIN OF tt_book.

INCLUDE STRUCTURE sbook.

  • color information

TYPES: it_colors TYPE lvc_t_scol,

END OF tt_book.

  • internal table

DATA: it_book TYPE TABLE OF tt_book,

  • work area for internal table

wa_book LIKE LINE OF it_book,

  • work area for internal table for colors

wa_colors LIKE LINE OF wa_book-it_colors.

LOOP AT it_book INTO wa_book.

  • field SMOKER shall be COL_GROUP if checked

IF wa_book-smoker = u2019Xu2019.

CLEAR wa_colors.

wa_colors-fname = u2019SMOKERu2019.

wa_colors-color-col = col_group.

wa_colors-color-int = 1.

APPEND wa_colors TO wa_book-it_colors.

ENDIF.

MODIFY it_book

FROM wa_book TRANSPORTING it_colors.

ENDLOOP.

...

  • set color column

  • preconditions:

  • 1. lr_columns is TYPE REF TO cl_salv_columns_table

  • 2. COLUMNS object has been retrieved

DATA: lr_columns TYPE REF TO cl_salv_columns_table.

lr_columns->set_color_column( value = u2019IT_COLORSu2019 ).

The procedure for changing the color of a whole row is, in principle, the same as for

changing the color of a cell. The color information is passed to the internal data table

using the additional table for the row. The only difference: no value is specified for

the field fname, meaning that the setting applies for the whole row. Regardless of this,

however, you can still assign different color values to individual cells in this row.

0 Kudos

how can i control the color- for eg if i want red or yellow ?