***INCLUDE <CL_ALV_CONTROL> .
CONSTANTS:
* Style 1
ALV_STYLE_COLOR_BACKGROUND(4) TYPE X VALUE ‘00000001‘,
ALV_STYLE_COLOR_HEADING(4) TYPE X VALUE ‘00000002‘,
ALV_STYLE_COLOR_NORMAL(4) TYPE X VALUE ‘00000003‘,
ALV_STYLE_COLOR_TOTAL(4) TYPE X VALUE ‘00000004‘,
ALV_STYLE_COLOR_KEY(4) TYPE X VALUE ‘00000005‘,
ALV_STYLE_COLOR_POSITIVE(4) TYPE X VALUE ‘00000006‘,
ALV_STYLE_COLOR_NEGATIVE(4) TYPE X VALUE ‘00000007‘,
ALV_STYLE_COLOR_GROUP(4) TYPE X VALUE ‘00000008‘,
ALV_STYLE_COLOR_INT_BACKGROUND(4) TYPE X VALUE ‘00000009‘,
ALV_STYLE_COLOR_INT_HEADING(4) TYPE X VALUE ‘0000000A‘,
ALV_STYLE_COLOR_INT_NORMAL(4) TYPE X VALUE ‘0000000B‘,
ALV_STYLE_COLOR_INT_TOTAL(4) TYPE X VALUE ‘0000000C‘,
ALV_STYLE_COLOR_INT_KEY(4) TYPE X VALUE ‘0000000D‘,
ALV_STYLE_COLOR_INT_POSITIVE(4) TYPE X VALUE ‘0000000E‘,
ALV_STYLE_COLOR_INT_NEGATIVE(4) TYPE X VALUE ‘0000000F‘,
ALV_STYLE_COLOR_INT_GROUP(4) TYPE X VALUE ‘00000010‘,
ALV_STYLE_COLOR_INV_BACKGROUND(4) TYPE X VALUE ‘00000011‘,
ALV_STYLE_COLOR_INV_HEADING(4) TYPE X VALUE ‘00000012‘,
ALV_STYLE_COLOR_INV_NORMAL(4) TYPE X VALUE ‘00000013‘,
ALV_STYLE_COLOR_INV_TOTAL(4) TYPE X VALUE ‘00000014‘,
ALV_STYLE_COLOR_INV_KEY(4) TYPE X VALUE ‘00000015‘,
ALV_STYLE_COLOR_INV_POSITIVE(4) TYPE X VALUE ‘00000016‘,
ALV_STYLE_COLOR_INV_NEGATIVE(4) TYPE X VALUE ‘00000017‘,
ALV_STYLE_COLOR_INV_GROUP(4) TYPE X VALUE ‘00000018‘,
ALV_STYLE_FONT_BOLD(4) TYPE X VALUE ‘00000020‘,
ALV_STYLE_FONT_BOLD_NO(4) TYPE X VALUE ‘00000040‘,
ALV_STYLE_FONT_ITALIC(4) TYPE X VALUE ‘00000080‘,
ALV_STYLE_FONT_ITALIC_NO(4) TYPE X VALUE ‘00000100‘,
ALV_STYLE_FONT_UNDERLINED(4) TYPE X VALUE ‘00000200‘,
ALV_STYLE_FONT_UNDERLINED_NO(4) TYPE X VALUE ‘00000400‘,
ALV_STYLE_ALIGN_LEFT_TOP(4) TYPE X VALUE ‘00000800‘,
ALV_STYLE_ALIGN_CENTER_TOP(4) TYPE X VALUE ‘00001000‘,
ALV_STYLE_ALIGN_RIGHT_TOP(4) TYPE X VALUE ‘00001800‘,
ALV_STYLE_ALIGN_LEFT_CENTER(4) TYPE X VALUE ‘00002000‘,
ALV_STYLE_ALIGN_CENTER_CENTER(4) TYPE X VALUE ‘00002800‘,
ALV_STYLE_ALIGN_RIGHT_CENTER(4) TYPE X VALUE ‘00003000‘,
ALV_STYLE_ALIGN_LEFT_BOTTOM(4) TYPE X VALUE ‘00003800‘,
ALV_STYLE_ALIGN_CENTER_BOTTOM(4) TYPE X VALUE ‘00004000‘,
ALV_STYLE_ALIGN_RIGHT_BOTTOM(4) TYPE X VALUE ‘00004800‘,
ALV_STYLE_FONT_SYMBOL(4) TYPE X VALUE ‘00008000‘,
ALV_STYLE_FONT_SYMBOL_NO(4) TYPE X VALUE ‘00010000‘,
ALV_STYLE_CHECKBOX_NOT_CHECKED(4) TYPE X VALUE ‘00020000‘,
ALV_STYLE_CHECKBOX_CHECKED(4) TYPE X VALUE ‘00040000‘,
ALV_STYLE_CHECKBOX_NO(4) TYPE X VALUE ‘00060000‘,
ALV_STYLE_ENABLED(4) TYPE X VALUE ‘00080000‘,
ALV_STYLE_DISABLED(4) TYPE X VALUE ‘00100000‘,
ALV_STYLE_SINGLE_CLK_EVENT(4) TYPE X VALUE ‘00200000‘,
ALV_STYLE_SINGLE_CLK_EVENT_NO(4) TYPE X VALUE ‘00400000‘,
ALV_STYLE_RADIO_NOT_CHECKED(4) TYPE X VALUE ‘00800000‘,
ALV_STYLE_RADIO_CHECKED(4) TYPE X VALUE ‘01000000‘,
ALV_STYLE_RADIO_NO(4) TYPE X VALUE ‘01800000‘,
ALV_STYLE_F4(4) TYPE X VALUE ‘02000000‘,
ALV_STYLE_F4_NO(4) TYPE X VALUE ‘04000000‘,
ALV_STYLE_IMAGE(4) TYPE X VALUE ‘08000000‘,
ALV_STYLE_NO_DELETE_ROW(4) TYPE X VALUE ‘10000000‘,
ALV_STYLE_BUTTON(4) TYPE X VALUE ‘20000000‘,
ALV_STYLE_BUTTON_NO(4) TYPE X VALUE ‘40000000‘,
* Style 2
ALV_STYLE2_NO_BORDER_LEFT(4) TYPE X VALUE ‘00010000‘,
ALV_STYLE2_NO_BORDER_RIGHT(4) TYPE X VALUE ‘00020000‘,
ALV_STYLE2_NO_BORDER_TOP(4) TYPE X VALUE ‘00040000‘,
ALV_STYLE2_NO_BORDER_BOTTOM(4) TYPE X VALUE ‘00080000‘,
* Style 3 ( WEBSTYLES ).
* Style 4
ALV_STYLE4_ZEBRA_ROW(4) TYPE X VALUE ‘00000001‘,
ALV_STYLE4_STOP_MERGE(4) TYPE X VALUE ‘00000002‘,
ALV_STYLE4_LINK(4) nbsp; TYPE X VALUE ‘00000004‘,
ALV_STYLE4_LINK_NO(4) TYPE X VALUE ‘00000008‘,
* Column Styles
ALV_COL_STYLE_SORT_UP(4) TYPE X VALUE ‘00000001‘,
ALV_COL_STYLE_SORT_DOWN(4) TYPE X VALUE ‘00000002‘,
ALV_COL_STYLE_FILTER(4) TYPE X VALUE ‘00000004‘,
ALV_COL_STYLE_TOTAL(4) TYPE X VALUE ‘00000008‘,
ALV_COL_STYLE_SUBTOTAL(4) TYPE X VALUE ‘00000010‘,
ALV_COL_STYLE_CHARACTERISTIC(4) TYPE X VALUE ‘00000020‘,
ALV_COL_STYLE_KEYFIGURE(4) TYPE X VALUE ‘00000040‘,
ALV_COL_STYLE_KEY(4) TYPE X VALUE ‘00000080‘,
ALV_COL_STYLE_EXCEPTION(4) TYPE X VALUE ‘00000100‘,
ALV_COL_STYLE_SIGNED_KEYFIGURE(4) TYPE X VALUE ‘00000200‘,
ALV_COL_STYLE_MERGE(4) TYPE X VALUE ‘00000400‘,
ALV_COL_STYLE_FIXED(4) TYPE X VALUE ‘00000800‘,
ALV_COL_STYLE_AUTO_VALUE(4) TYPE X VALUE ‘00001000‘,
ALV_COL_STYLE_NO_DISP(4) TYPE X VALUE ‘00002000‘,
ALV_COL_STYLE_HASREF(4) TYPE X VALUE ‘00004000‘,
ALV_COL_STYLE_AVERAGE(4) TYPE X VALUE ‘00008000‘,
ALV_COL_STYLE_MIN(4) TYPE X VALUE ‘00010000‘,
ALV_COL_STYLE_MAX(4) TYPE X VALUE ‘00020000‘.
附上一个网上找到的例子(可直接运行),改例子是关于设置ALV单元格内字体格式的,比如说粗体,其它ALV控制的操作可以看我博客SAP-ALV分类的其它文章。
FS:该例子由原作者保留版权