登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

i_callback_html_top_of_page参数的使用  

2011-01-07 15:57:09|  分类: ALV |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

*---------------------------- 例一 ------------------------------------
report  z_barry_alv_header.
tables t001.
type-poolsslis.
data w_repid like sy-repid.
types begin of ty_comp.
        
include structure t001.
types end of ty_comp.
datawa_layout  type slis_layout_alv.
datait_fieldcat type slis_t_fieldcat_alv,
      wa_fieldcat 
type slis_fieldcat_alv.
data it_comp type table of ty_comp.

initialization.
  w_repid 
sy-repid.

start
-of-selection.

  
select from t001 into table it_comp.

end-of-selection.

  
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    
exporting
      i_program_name         
w_repid
      i_internal_tabname     
'IT_COMP'
      i_structure_name       
'T001'
      i_inclname             
w_repid
    
changing
      ct_fieldcat            
it_fieldcat[]
    
exceptions
      inconsistent_interface 
1
      program_error          
2
      
others                 3.
  
call function 'REUSE_ALV_GRID_DISPLAY'
    
exporting
      i_callback_program          
w_repid
      i_callback_html_top_of_page 
'HTML_TOP_OF_PAGE'
      is_layout                   
wa_layout
      it_fieldcat                 
it_fieldcat
      i_html_height_top           
20     "HTML框的高度
    
tables
      t_outtab                    
it_comp
    
exceptions
      program_error               
1
      
others                      2.

*&---------------------------------------------------------------------*
*&      Form  html_top_of_page
*&---------------------------------------------------------------------*
form html_top_of_page using document type ref to cl_dd_document.
  
datatext type sdydo_text_element.
  
text =  'Company Code Data'.
  
call method document->add_text
    
exporting
      
text      text
      sap_style 
'HEADING'.
  
call method document->new_line.
  
call method document->new_line.
  
text 'User Name : '.
  
call method document->add_text
    
exporting
      
text         text
      sap_emphasis 
'Strong'.
  
call method document->add_gap
    
exporting
      width 
2.
  
text sy-uname.
  
call method document->add_text
    
exporting
      
text      text
      sap_style 
'Key'.
  
call method document->add_gap
    
exporting
      width 
10.
  
text 'Date : '.
  
call method document->add_text
    
exporting
      
text         text
      sap_emphasis 
'Strong'.
  
call method document->add_gap
    
exporting
      width 
2.
  
text sy-datum.
  
call method document->add_text
    
exporting
      
text      text
      sap_style 
'Key'.
  
call method document->add_gap
    
exporting
      width 
10.
  
text 'Time : '.
  
call method document->add_text
    
exporting
      
text         text
      sap_emphasis 
'Strong'.
  
call method document->add_gap
    
exporting
      width 
2.
  
text sy-uzeit.
  
call method document->add_text
    
exporting
      
text      text
      sap_style 
'Key'.
  
call method document->new_line.
endform.                    "HTML_TOP_OF_PAGE

*------------------------ 例二:ALVHTML抬头内容根据ALV事件更改 ---------------------------------
report  z_barry_alv_header .

tables t001.
type-poolsslis.
data w_repid like sy-repid.
types begin of ty_comp.
        
include structure t001.
types end of ty_comp.
datawa_layout  type slis_layout_alv.
datait_fieldcat type slis_t_fieldcat_alv,
      wa_fieldcat 
type slis_fieldcat_alv.
data it_comp type table of ty_comp with header line.

initialization.
  w_repid 
sy-repid.

start
-of-selection.
  
select from t001 into table it_comp.
  it_comp
-butxt '双击ALV的行'.

  
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    
exporting
      i_program_name         
w_repid
      i_internal_tabname     
'IT_COMP'
      i_structure_name       
'T001'
      i_inclname             
w_repid
    
changing
      ct_fieldcat            
it_fieldcat[]
    
exceptions
      inconsistent_interface 
1
      program_error          
2
      
others                 3.
  
call function 'REUSE_ALV_GRID_DISPLAY'
    
exporting
      i_callback_program          
w_repid
      i_callback_html_top_of_page 
'HTML_TOP_OF_PAGE'
      i_callback_user_command     
'USER_COMMAND'
      is_layout                   
wa_layout
      it_fieldcat                 
it_fieldcat
    
tables
      t_outtab                    
it_comp
    
exceptions
      program_error               
1
      
others                      2.

*&---------------------------------------------------------------------*
*&      Form  html_top_of_page
*&---------------------------------------------------------------------*
form html_top_of_page using w_doc type ref to cl_dd_document.
  
datacode(255type c .
  
datasdydo_html_table type sdydo_html_line occurs 0.
  
datawa like line of sdydo_html_table.
  
call method w_doc->set_document_background
    
exporting
      picture_id 
'ENJOYSAP_LOGO'.
  
clear code.
  
refresh w_doc->html_table.
  wa
-line '<HTML><BODY bottommargin="0" background="005.jpg">' &
            
'<SPAN Style="FONT-SIZE: 15pt; COLOR: black; FONT-FAMILY: 黑体; ">' &
            
'<B>测试ALVHeader显示HTML</b></SPAN><br><br><br>'.
  
append wa to w_doc->html_table.
  
concatenate '<SPAN Style="FONT-SIZE: 12pt; COLOR: #FF6400; FONT-FAMILY: 黑体; "> <B>'
              it_comp
-butxt '</b></SPAN><br><br><br>' into wa-line.
  
append wa to w_doc->html_table.
  wa
-line '<embed src="D:\sxl\kita\yshq.mp3" autostart=true></BODY></HTML>'.
  
append wa to w_doc->html_table.
endform.                    "HTML_TOP_OF_PAGE
*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
form user_command using r_ucomm like sy-ucomm
                        rs_selfield 
type slis_selfield.
  
case r_ucomm.
    
when '&IC1'.
      
read table it_comp index rs_selfield-tabindex.
    
when 'EXIT'.
      
leave program.
  
endcase.
endform"user_com

  评论这张
 
阅读(1688)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018