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

原来为了你

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

 
 
 

日志

 
 
 
 

[转]显示红绿灯  

2011-08-08 18:17:15|  分类: ALV |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

*---方式一、alv
*------- Data definition ---------------------------------------------
databegin of gt_output occurs 0.
include type spfli.
datastatus type char2.    "在输出内表中定义:‘1’红色,'2'黄色,‘3’绿色
dataend of gt_output.

*---Alv data definition
type-poolsslis.
datags_layout type slis_layout_alv.
gs_layout
-zebra             'X'.
gs_layout
-colwidth_optimize 'X'.
gs_layout
-lights_fieldname  'STATUS'.   "layout中定义

datagt_fieldcat type slis_t_fieldcat_alv with header line.
define  m_alv_head.
  
clear gt_fieldcat.
  gt_fieldcat
-fieldname '&1'.
  gt_fieldcat
-seltext_m '&2'.
  gt_fieldcat
-no_zero   ''.

  
append gt_fieldcat.
end-of-definition.


*------- Start-of-selection ------------------------------------------
start
-of-selection.

  
select into table gt_output
    
from spfli.

  
loop at gt_output.
    
if gt_output-carrid 'AA'.
      gt_output
-status '3'.                               "123 红黄绿
    
else.
      gt_output
-status '1'.
    
endif.
    
modify gt_output.
  
endloop.
*------- End-of-selection --------------------------------------------
end-of-selection.

*---Set fields
  
clear gt_fieldcat[].
  m_alv_head carrid        carrid
.
  m_alv_head connid        connid
.

  
if gt_output[] is initial.
    
message '没有数据!' type 'S'.
    
leave list-processing.
  
endif.

*---Set titlebar

  
call function 'REUSE_ALV_GRID_DISPLAY'
    
exporting
      i_callback_program 
sy-repid
      is_layout          
gs_layout
      it_fieldcat        
gt_fieldcat[]  "'[]' is necessary
      i_save             
'A'
    
tables
      t_outtab           
gt_output
    
exceptions
      program_error      
1
      
others             2.

*---方式二、wirte
  
databegin of itab occurs 0,
          
icon(4type  c,
          int1 
type  i,
        
end of itab.

  
datawa like line of itab.
  wa
-int1 '-3'.
  
append wa to itab.

  wa
-int1 '3'.
  
append wa to itab .

start
-of-selection.
  
loop at itab into wa .
    
if wa-int1 < .
      wa
-icon '@5C@'.
    
else.
      wa
-icon '@5B@'.
    
endif.        .
    
modify itab from wa.
  
endloop.

start
-of-selection.
  
loop at itab into wa .
    
write/ wa-icon wa-int1.
  
endloop.

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

历史上的今天

评论

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

页脚

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