Set colors for the ALV grid of object-oriented (OO)

Source: Internet
Author: User


In normal ALV development, the customer needs to draw some special colors in the ALV mesh so that they can see what they want in the first place, without the settings of these colors
It is difficult to find what you care about from a large amount of data displayed. Next I will introduce you to setting the colors of columns, rows, and cells in ALV grid:
1) column color settings

The column color settings are relatively simple, because the field color settings are provided in the Field Directory type lvc_s_fcat.


Emphasize to implement:
For example, w_fcat type lvc_s_fcat.
W_fcat-

Emphasize = 'c701 '.
Note that if the key column of the color column is set, the color will not work.
2) Row color settings

To set the color of a row, it is a little complicated to set the relative column. You need to add a field in the displayed table to display the color. This field does not need to be set in the Field Directory, the implementation is as follows:
For example, data: Begin of t_itab occurs 0,
... (Field)
Rowcolor (4) type C, "Add a new field to set the color of the row
End of t_itab.
The field used to set the color is added. How does ALV know that you have set the color, in the layout type of ALV, a field info_name is used to set the color of the notification ALV: (this step is very important)
For example, s_lay type lvc_s_layo.
S_lay-info-name = 'rowcolor '.
"Rowcolor is the field added to the display output table above.
After completing the above two steps, we need to set the color for the lines in coding:
For example, loop at t_itab.
If t_itab-a EQ '1 '.
T_itab-rowcolor = '4'. "Set color
Modify t_itab.
Endif.
Endloop.
Some people need to call refresh to display and set the color when introducing it online. After my test, it is actually not!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.