以下是纯顾问群~
QQ群 :SAP干货铺, 群号:775662808
所有群管理严格,严格禁止一切外来链接、招聘、广告等垃圾信息!
如果您觉得这篇干货文章有用,请帮忙转载、分享给更多人,谢谢~
直接上干货吧~
最终效果图:
点击超链接后:
直接上参考代码吧:
REPORT ZLM_ALV013.
DATA:GT_DATA TYPE TABLE OF SPFLI.
DATA:GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
START-OF-SELECTION.
"获取数据
SELECT * FROM SPFLI INTO TABLE GT_DATA.
"展示数据
GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GS_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_HTML_TOP_OF_PAGE = 'HTML_TOP_OF_PAGE'
I_HTML_HEIGHT_TOP = 40 "控制表头栏目的初始高度
IS_LAYOUT = GS_LAYOUT
I_STRUCTURE_NAME = 'SPFLI'
TABLES
T_OUTTAB = GT_DATA
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*&TOP_OF_PAGE
FORM HTML_TOP_OF_PAGE USING DOCUMENT TYPE REF TO CL_DD_DOCUMENT.
DATA: TEXT TYPE SDYDO_TEXT_ELEMENT.
DATA: M_P TYPE I,
M_BUFFER TYPE STRING.
CLEAR M_BUFFER.
CONCATENATE
'<HTML>'
'<h1 align="center">' "标题 剧中 h1 默认就是加粗
'<font color="red">' "颜色 红色
'<font size="5px">' "字体大小 5像素
'SAP干货铺' "文本
'</font>'
'</font>'
'</h1> '
'</HTML>'
INTO M_BUFFER.
"使用html insert css布局保证了 标题永远居中
CALL METHOD DOCUMENT->HTML_INSERT
EXPORTING
CONTENTS = M_BUFFER
CHANGING
POSITION = M_P.
CLEAR M_BUFFER.
CONCATENATE
'<HTML>'
'<p align="right">' "右对齐
'<font color="blue" >' " 蓝色,
'<font size="3px">' "大小
'<i>' "斜体
'<b>' "加粗
'SAP干货铺测试' "文本
'</b>'
'</i>'
'</font>'
'</font>'
'</p>'
'</HTML>'
INTO M_BUFFER.
CALL METHOD DOCUMENT->HTML_INSERT
EXPORTING
CONTENTS = M_BUFFER
CHANGING
POSITION = M_P.
CLEAR M_BUFFER.
CONCATENATE
'<HTML>'
'<p align="left">' "对齐方式
'<font color="purple" >' "颜色
'<font size="4px">' "大小
* '<i>' "斜体
* '<b>' "加粗
'SAP干货铺测试' "文本
* '</b>'
* '</i>'
'</font>'
'</font>'
'</p>'
'</HTML>'
INTO M_BUFFER.
CALL METHOD DOCUMENT->HTML_INSERT "
EXPORTING
CONTENTS = M_BUFFER
CHANGING
POSITION = M_P.
CLEAR M_BUFFER.
CONCATENATE
'<HTML>'
'<p align="left">' "对齐方式
'<font color="red" >' "颜色
'<font size="2px">' "大小
'<i>' "斜体
'<b>' "加粗
'SAP干货铺测试' "文本
'</b>'
'</i>'
'</font>'
'</font>'
'</p>'
'</HTML>'
INTO M_BUFFER.
CALL METHOD DOCUMENT->HTML_INSERT "
EXPORTING
CONTENTS = M_BUFFER
CHANGING
POSITION = M_P.
TEXT = '欢迎关注公众号:SAP干货铺'.
CALL METHOD DOCUMENT->ADD_TEXT
EXPORTING
TEXT = TEXT
SAP_STYLE = CL_DD_DOCUMENT=>SUCCESS "WARNING
SAP_COLOR = CL_DD_DOCUMENT=>LIST_TOTAL_INT
SAP_FONTSIZE = CL_DD_DOCUMENT=>LARGE
SAP_FONTSTYLE = CL_DD_DOCUMENT=>SERIF
SAP_EMPHASIS = CL_DD_DOCUMENT=>EMPHASIS.
"添加超链接
CALL METHOD DOCUMENT->ADD_LINK
EXPORTING
URL = 'https://mp.weixin.qq.com/s/7l7E1ZNYRnPNfezPZKRA8Q'
TOOLTIP = '欢迎访问干货铺'
TEXT = '双击访问SAP干货铺Debug系列文章'.
CALL METHOD DOCUMENT->NEW_LINE.
"Draw an underLine 下划线
CALL METHOD DOCUMENT->UNDERLINE.
*&----------日期
"添加图标
CALL METHOD DOCUMENT->ADD_ICON
EXPORTING
SAP_ICON = 'ICON_DATE'. "到 ICON 表中找就行
TEXT = 'Date : '.
CALL METHOD DOCUMENT->ADD_TEXT "添加文本
EXPORTING
TEXT = TEXT
SAP_EMPHASIS = 'Strong'. "加粗
CALL METHOD DOCUMENT->ADD_GAP
EXPORTING
WIDTH = 1. "两个空格
TEXT = SY-DATUM..
CALL METHOD DOCUMENT->ADD_TEXT
EXPORTING
TEXT = TEXT
SAP_EMPHASIS = 'Strong'. "加粗
CALL METHOD DOCUMENT->ADD_GAP
EXPORTING
WIDTH = 6. "6个空格
*&----------时间
"添加图标
CALL METHOD DOCUMENT->ADD_ICON
EXPORTING
SAP_ICON = 'ICON_TIME'. "到 ICON 表中找就行
TEXT = 'Time : '.
CALL METHOD DOCUMENT->ADD_TEXT
EXPORTING
TEXT = TEXT
SAP_EMPHASIS = ' '. "
CALL METHOD DOCUMENT->ADD_GAP
EXPORTING
WIDTH = 1.
TEXT = SY-UZEIT..
CALL METHOD DOCUMENT->ADD_TEXT
EXPORTING
TEXT = TEXT
SAP_EMPHASIS = ' '. "
" 添加新行
CALL METHOD DOCUMENT->NEW_LINE.
ENDFORM. "HTML_TOP_OF_PAGE