ALV的html表头
在ALV的function的exporting里添加属性:
*&---------------------------------------------------------------------*
*& Form alv_top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM ALV_TOP_OF_PAGE USING CL_DD TYPE REF TO CL_DD_DOCUMENT.
DATA: M_P TYPE I.
DATA: M_BUFF TYPE STRING.
DATA: LV_COMPANY LIKE T001-BUTXT,
LV_MONTH(02) TYPE C,
LV_DAY(02) TYPE C.
DATA: LV_YEAR TYPE F.
LV_YEAR = '2012'."P_ZYEAR.
* COMPUTE LV_YEAR = FRAC( LV_YEAR / 4 ).
* LV_MONTH = '02'."P_ZMONTH+1(2).
*
* CASE LV_MONTH.
* WHEN 1 OR 3 OR 5 OR 7 OR 8 OR 10 OR 12.
* LV_DAY = '31'.
* WHEN 2.
* IF LV_YEAR = 0 .
* LV_DAY = '29'.
* ELSE.
* LV_DAY = '28'.
* ENDIF.
* WHEN 4 OR 6 OR 9 OR 11.
* LV_DAY = '30'.
* ENDCASE.
*表头其实完全可以是一个html文件,自己使用html语言进行格式控制
M_BUFF = '<html>'.
CALL METHOD CL_DD->HTML_INSERT
EXPORTING
CONTENTS = M_BUFF
CHANGING
POSITION = M_P.
M_BUFF = '<center><H2>研 发 费 用 明 细 表</H2></center>'.
CALL METHOD CL_DD->HTML_INSERT
EXPORTING
CONTENTS = M_BUFF
CHANGING
POSITION = M_P.
** CONCATENATE '单位编号:' P_ZBUKRS '会企01表' '<BR>' INTO M_BUFF.
*CONCATENATE '<table width="1200"><tr><td>' '</td><td><div align="right"></div></td></tr></table>' INTO M_BUFF.
* CALL METHOD CL_DD->HTML_INSERT
* EXPORTING
* CONTENTS = M_BUFF
* CHANGING
* POSITION = M_P.
* CONCATENATE '单位名称:' LV_COMPANY P_ZYEAR '年' LV_MONTH '月' LV_DAY '日' '单位:元' '<BR>' INTO M_BUFF.
CONCATENATE '<table width="1200"><tr><td width="480">编制单位:辰欣药业股份有限公司' '</td><td width="250"><div align="center">' P_DATUM '</div></td><td width="454"><div align="right">单位:人民币元</div></td></tr></table>' INTO M_BUFF.
CALL METHOD CL_DD->HTML_INSERT
EXPORTING
CONTENTS = M_BUFF
CHANGING
POSITION = M_P.
M_BUFF = '</html>'.
CALL METHOD CL_DD->HTML_INSERT
EXPORTING
CONTENTS = M_BUFF
CHANGING
POSITION = M_P.
ENDFORM. "ALV_TOP_OF_PAGE