ALV表头HTML实现详解编程语言

FORM frm_html_top_of_page USING cl_dd TYPE REF TO cl_dd_document. 
DATA: m_p TYPE i. 
DATA: m_buff TYPE string. 
DATA:m_kunnr TYPE string. 
DATA:m_bukrs TYPE string. 
SELECT SINGLE name1 INTO m_kunnr FROM kna1 WHERE kunnr IN s_kunnr. 
CONCATENATE '客户:' m_kunnr '对账单' INTO m_kunnr. 
*表头其实完全可以是一个html文件,自己使用html语言进行格式控制 
m_buff = '<html>'. 
CALL METHOD cl_dd->html_insert 
EXPORTING 
contents = m_buff 
CHANGING 
position = m_p. 
SELECT SINGLE butxt INTO m_bukrs FROM t001 WHERE bukrs IN s_bukrs. 
CONCATENATE '<center><H2>' m_bukrs  '</H2></Center>' INTO m_buff. 
CALL METHOD cl_dd->html_insert 
EXPORTING 
contents = m_buff 
CHANGING 
position = m_p. 
CONCATENATE '<center><H3>' m_kunnr  '</H3></Center>' INTO m_buff. 
CALL METHOD cl_dd->html_insert 
EXPORTING 
contents = m_buff 
CHANGING 
position = m_p. 
CONCATENATE '<center>对账日期:' sy-datum+0(4) '' sy-datum+4(2) ''  sy-datum+6(2) '' '</Center>' 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. 
gv_company_name = m_bukrs. 
gv_customer_name = m_kunnr. 
gv_date = '对账日期:' && sy-datum+0(4) && '' && sy-datum+4(2) && '' &&  sy-datum+6(2) && ''. 
ENDFORM.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
EXPORTING 
i_callback_program          = sy-repid 
i_callback_pf_status_set    = 'FRM_PF_STATUS' 
i_callback_user_command     = 'FRM_USER_COMMAND' 
i_callback_html_top_of_page = 'FRM_HTML_TOP_OF_PAGE' 
is_layout                   = ls_layout 
it_fieldcat                 = gt_fieldcat 
*     IT_SORT                     = GT_SORT 
i_default                   = 'X' 
i_save                      = 'A' 
TABLES 
t_outtab                    = gt_show 
EXCEPTIONS 
program_error               = 1 
OTHERS                      = 2. 
IF sy-subrc <> 0. 
* Implement suitable error handling here 
ENDIF.

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18623.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论