SAP alv(lvc)的抬头标题设定(html_top_of_page)
对alv的抬头标题设置方法
方法1:通过class:cl_dd_document设定
call alv
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY_LVC‘
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = ‘FRM_PF_STATUS_SET‘
i_callback_user_command = ‘FRM_USER_COMMAND‘
i_callback_html_top_of_page = ‘HTML_TOP_OF_PAGE‘
is_layout_lvc = gwa_lay
it_fieldcat_lvc = gt_fcat
TABLES
t_outtab = gt_list.
定义子程序(form)
*&---------------------------------------------------------------------*
*& Form html_top_of_page
*&---------------------------------------------------------------------*
FORM html_top_of_page USING document TYPE REF TO cl_dd_document.
DATA: text TYPE sdydo_text_element.
LOOP AT gt_proj INTO gwa_proj.
text = text-010. "项目编号
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-pspid.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052. "加粗还是斜体 STRONG是加粗
CALL METHOD document->add_gap
EXPORTING
width = 40.
text = text-011. "项目名称
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-post1.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->new_line.
CALL METHOD document->underline. "Draw an underLine
text = text-012. "SOP时间
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-zsopsj.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 40.
text = text-013. "客户名称
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-zzjkh.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 40.
text = text-014. "厂房模式
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-zcfms.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
CALL METHOD document->new_line.
CALL METHOD document->underline. "Draw an underLine
text = text-015. "公司性质
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-zgsxz.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 40.
text = text-016. "客户产能
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-zkhcn.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 40.
text = text-017. "客户启动会议日期
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
text = gwa_proj-zqdhysj.
CALL METHOD document->add_text
EXPORTING
text = text
sap_emphasis = text-052.
CALL METHOD document->add_gap
EXPORTING
width = 2.
CALL METHOD document->new_line.
CALL METHOD document->underline. "Draw an underLine
ENDLOOP.
ENDFORM. "HTML_TOP_OF_PAGE
效果图如下:
方法2:通过编写html代码实现
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* top_of_page
*----------------------------------------------------------------------*
FORM top_of_page USING w_doc TYPE REF TO cl_dd_document.
DATA: lt_html_table TYPE sdydo_html_line OCCURS 0.
DATA: ls_htmltab LIKE LINE OF lt_html_table.
REFRESH w_doc->html_table.
ls_htmltab-line =
‘<HTML><BODY bottommargin="0" background=" ">‘ &
‘<SPAN Style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Arial; ">‘
& ‘<br /><B>‘
&& ‘工厂 :‘ && p_werks && ‘</B> <BR>‘.
APPEND ls_htmltab TO w_doc->html_table.
CLEAR ls_htmltab.
ls_htmltab-line =
‘<br /><B>‘
&& ‘未维护比例:‘ && gv_perct && ‘</B> </<BR></SPAN>‘.
APPEND ls_htmltab TO w_doc->html_table.
CLEAR ls_htmltab.
ls_htmltab-line = ‘</BODY></HTML>‘.
APPEND ls_htmltab TO w_doc->html_table.
ENDFORM. "top_of_page
效果图如下:
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。