• ABAP如何在REUSE_ALV_GRID_DISPLAY标识不同行用不同的颜色


    1 在内表中加入颜色字段
    .............................
     color(4) type c,
    ................................

    2 在内表添加记录是通过条件设置颜色字段值
    wa_customerinfo-color = 'C110'.

    3 设置颜色控制内表 slis_layout_alv 的颜色字段为内表增加的颜色字段
        data  g_slis_layo type slis_layout_alv.   "定义Grid输出颜色控制内表
        g_slis_layo-info_fieldname = 'COLOR'.

    4 输出记录
        call function 'REUSE_ALV_GRID_DISPLAY'
          exporting
            i_callback_program = g_repid
            is_layout          = g_slis_layo
            it_fieldcat        = g_field[]
            it_sort            = g_sort[]
            it_events          = event_top_of_page[]
          tables
            t_outtab           = i_customerinfo.

    以下为显示表头的代码
    data  event_top_of_page   type slis_alv_event  occurs 0 with header line. 
    perform event_top_of_page tables event_top_of_page.

    form event_top_of_page tables rt_event type slis_t_event.
      refresh rt_event.
      clear rt_event.
      rt_event-name = slis_ev_top_of_page.
      rt_event-form = 'WRITE_TOP_OF_PAGE'.
      append rt_event.
    endform.                    "event_top_of_page

    form write_top_of_page.
      data: hline type slis_listheader,
           text(60) type c,
           text10(10) type c,
           text5(5) type c,
           percent type p decimals 2.

      refresh head.
      clear head.
      clear: hline, text.
      hline-typ  = 'S'.
      write: '时间:', g_curdate  to text.
      hline-info = text.
      append hline to head.
      write: '客户状态:绿色-老呆死客户,红色-新呆死客户,兰色-超信用额度客户'
        to text.
      hline-info = text.
      write: g_countkunnr  to text5.
      append hline to head.
      concatenate '往来单位:' text5 '个.' into text.
      hline-info = text.
      append hline to head.
      write: g_oldbad_count  to text5.
      concatenate '老呆死帐单位:' text5 '个,占' into text.
      percent = g_oldbad_count * 100 / g_countkunnr.
      write: percent  to text5.
      concatenate text5 '%' into text+23.
      write: g_newbad_count  to text5.
      concatenate '新呆死单位:' text5 '个,占' into text+30.
      percent = g_newbad_count * 100 / g_countkunnr.
      write: percent  to text5.
      concatenate text5 '%' into text+53.
    *  CONDENSE text.
      hline-info = text.
      append hline to head.
      clear text.
      percent = g_ccdebit_count / 10000.
      write: percent  to text10.
      concatenate '应收帐款:' text10 '万元' into text.
      percent = g_webtr_count / 10000.
      write: percent  to text10.
      concatenate '认可呆死帐:' text10  '万元.' into  text+30.
      hline-info = text.
      append hline to head.

      percent = g_oldbad_money / 10000.
      write: percent  to text10.
      concatenate '老呆死帐款:' text10 '万元,' into text.
      percent = g_oldbad_money * 100 / g_ccdebit_count.
      write: percent  to text5.
      concatenate '占' text5 '%' into text+30.
      hline-info = text.
      append hline to head.

      percent = g_newbad_money / 10000.
      write: percent  to text10.
      concatenate '新呆死帐款:' text10 '万元,' into text.
      percent = g_newbad_money  * 100 / g_ccdebit_count.
      write: percent  to text5.
      concatenate '占' text5 '%' into text+30.
      hline-info = text.
      append hline to head.

      write: g_over_count  to text5.
      concatenate '超安全额度单位:' text5 '个,' into text.
      percent = g_over_count * 100 / g_countkunnr.
      write: percent  to text5.
      concatenate '占' text5 '%' into text+24.
      percent = g_over_money / 10000.
      write: percent  to text10.
      concatenate  '超安全额度:' text10 '万元.' into text+30.
      hline-info = text.
      append hline to head.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = head.
    endform.                    "write_top_of_page

  • 相关阅读:
    Centos安装JIRA 7.13版本(自己在官方下载最新版)以及破解
    5. iphone 的:active样式
    4. css事件
    3. css百度制作字体图片
    8. react 常用组件
    3. JS生成32位随机数
    JS大小转化B KB MB GB的转化方法
    7.关于一些dom&&获取元素
    加密问题
    2.hover的使用
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157517.html
Copyright © 2020-2023  润新知