问题
We are trying to manipulate the alv grid class to get result like in Sap Agenda (SSC1 tcode) i.e. to merge columns and rows.
We found that the class cl_calendar_control_schedule
with the method display
handles that and we are working to understand the content of this method and its parameters.
We found that the internat table of lvc_t_data
type handles horizontal and/or vertical merging of cells (one row of this Internal table for each cell), but I struggle to understand how to code cell styling, for example, if i want to wipe just the bottom border or left border. What is the style of different colors, different bolding styles, underlines...?
We found that apart from this variable there is lvc_t_info
typed parameter, what is it for?
Thanks
回答1:
I Found the answer. Thanks to everyone:
You have to include the cl_alv_contol and you can give all style that you want, like alv_style_color_background + alv_style_font_bold, and the code is a constant in this include.
***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) 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'.
来源:https://stackoverflow.com/questions/27000012/merging-cells-and-cell-formatting-in-alv