码迷,mamicode.com
首页 > 其他好文 > 详细

sap alv 添加状态灯

时间:2020-06-08 23:46:44      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:fun   class   and   write   cpu   时间   other   udt   UNC   

*&---------------------------------------------------------------------*
INCLUDE <icon>.
TYPES:BEGIN OF ty_out,
        seq     TYPE char6,      "序号
        werks   TYPE marc-werks, "工厂
        matnr   TYPE marc-matnr, "物料号
        maktx   TYPE makt-maktx, "物料描述
        ersda   TYPE mara-ersda, "创建时间
        mtart   TYPE mara-mtart, "物料类型
        beskz   TYPE marc-beskz, "采购类型
        sobsl   TYPE marc-sobsl, "特殊采购类型
        flag1   TYPE char1,      "外购件计划价
        flag2   TYPE char1,      "自制件BOM
        andat   TYPE mast-andat, "BOM创建时间
        flag3   TYPE char1,      "自制件工艺路线
        andat_p TYPE plko-andat, "工艺路线创建时间
        flag4   TYPE char1,      "自制件工时
        flag5   TYPE char1,      "自制件成本核算状态
        cpudt   TYPE keko-cpudt, "自制件成本核算时间
        status  TYPE char1,      "状态
        light   TYPE icons-text,      " 红绿灯
        descr   TYPE char40,     "状态说明
      END OF ty_out.
DATA:gt_out TYPE TABLE OF ty_out,
     gs_out TYPE ty_out.


*&---------------------------------------------------------------------*
*&                FRM_CREATE_ICON
*&---------------------------------------------------------------------*
FORM frm_create_icon USING i_coname TYPE string
                     CHANGING c_out TYPE icons-text.

*WRITE: ICON_GREEN_LIGHT AS ICON.
*WRITE: ICON_YELLOW_LIGHT AS ICON.
*WRITE: ICON_RED_LIGHT AS ICON.
  CALL FUNCTION ICON_CREATE
    EXPORTING
      name                  = i_coname
      add_stdinf            = X
    IMPORTING
      result                = c_out
    EXCEPTIONS
      icon_not_found        = 1
      outputfield_too_short = 2
      OTHERS                = 3.
ENDFORM.

loop at gt_out ASSIGNING FIELD-SYMBOL(<lfs_out>).
    IF <lfs_out>-status = R.
      PERFORM frm_create_icon USING ICON_RED_LIGHT
                               CHANGING    <lfs_out>-light.
    ELSE.
      PERFORM frm_create_icon USING ICON_GREEN_LIGHT
                               CHANGING    <lfs_out>-light.
    ENDIF.
  ENDLOOP.

 

sap alv 添加状态灯

标签:fun   class   and   write   cpu   时间   other   udt   UNC   

原文地址:https://www.cnblogs.com/JackeyLove/p/13069279.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!