FM 方式ALV
红绿灯
*&
*&
*&---------------------------------------------------------------------*
*1)在alv引用类型池定义时加入icon,如type-pools:
*
*2)给显示内表itab定义一字段statu存储状态灯;
*
*3)循环内表itab给字段statu值赋:
*绿灯:itab-statu
*红灯:itab-statu
*4)alv的fieldcat属性i_fieldcat-icon
*&---------------------------------------------------------------------*
REPORT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
TYPE-POOLS:
*&---------------------------------------------------------------------*
*&基本数据定义
*&---------------------------------------------------------------------*
DATA:
DATA:
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
DATA:
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
DEFINE
END-OF-DEFINITION.
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
FORM
ENDFORM.
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM
ENDFORM.
OO 方式ALV
红绿灯
效果:
主要代码:
*&---------------------------------------------------------------------*
*& 全局变量
*&---------------------------------------------------------------------*
DATA:
DATA:
START-OF-SELECTION.
FORM zform_alv_show .
* 屏幕初始化
*
side
=
cl_gui_docking_container=>dock_at_right
”ALV贴屏幕右边,从屏幕右边开始算宽度
*
style
=
cl_gui_control=>ws_child
"可选参数,设置ALV是否可用手动拖动大小
*添加自定义工具条
*
*构建显示字段样式
* layout 设定样式
* event 绑定事件
* SET HANDLER
g_event->handle_f4
FOR
g_alv_grid.
* "显示内表数据
ENDFORM.
" ZFORM_ALV_SHOW