当前位置:网站首页>SAP ALV cell level set color
SAP ALV cell level set color
2022-07-06 03:23:00 【rogerix4】
=>Reference:SAP ALV Color code corresponding color ( Arrangement )
1. Code
TYPES: BEGIN OF ty_alv,
id TYPE i,
color_code TYPE numc3,
color TYPE lvc_t_scol,
END OF ty_alv.
DATA: gt_alv TYPE TABLE OF ty_alv,
gs_layout TYPE lvc_s_layo,
gt_fieldcat TYPE lvc_t_fcat WITH HEADER LINE.
DEFINE fieldcat.
gt_fieldcat-fieldname = &1 . " The field name of the inner table that needs to be output
gt_fieldcat-ref_field = &2 .
gt_fieldcat-ref_table = &3 .
gt_fieldcat-scrtext_s = &4 .
APPEND gt_fieldcat.
CLEAR gt_fieldcat.
END-OF-DEFINITION.
INITIALIZATION.
START-OF-SELECTION.
PERFORM frm_fill_layout.
PERFORM frm_fill_fieldcat.
PERFORM frm_get_data.
PERFORM frm_fill_color.
END-OF-SELECTION.
PERFORM frm_display_data.
*--------------------------------------------------*
FORM frm_fill_layout .
gs_layout-cwidth_opt = abap_true . " Automatically optimize column width
gs_layout-ctab_fname = 'COLOR'.
ENDFORM.
FORM frm_fill_fieldcat .
fieldcat: 'ID' '' '' ' Count ',
'COLOR_CODE' '' '' ' Color code '.
ENDFORM.
FORM frm_display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = sy-repid
is_layout_lvc = gs_layout
it_fieldcat_lvc = gt_fieldcat[]
TABLES
t_outtab = gt_alv
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
FORM frm_get_data .
gt_alv = VALUE #( ( id = 1 color_code = '100' )
( id = 2 color_code = '200' )
( id = 3 color_code = '300' )
( id = 4 color_code = '400' )
( id = 5 color_code = '500' )
( id = 6 color_code = '600' )
( id = 7 color_code = '700' )
( id = 8 color_code = '101' )
( id = 9 color_code = '201' )
( id = 10 color_code = '301' )
( id = 11 color_code = '401' )
( id = 12 color_code = '501' )
( id = 13 color_code = '601' )
( id = 14 color_code = '701' )
( id = 15 color_code = '110' )
( id = 16 color_code = '210' )
( id = 17 color_code = '310' )
( id = 18 color_code = '410' )
( id = 19 color_code = '510' )
( id = 20 color_code = '610' )
( id = 21 color_code = '710' )
( id = 22 color_code = '111' )
( id = 23 color_code = '211' )
( id = 24 color_code = '311' )
( id = 25 color_code = '411' )
( id = 26 color_code = '511' )
( id = 27 color_code = '611' )
( id = 28 color_code = '711' ) ).
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FRM_FILL_COLOR
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_fill_color.
DATA: ls_color TYPE lvc_s_scol.
LOOP AT gt_alv ASSIGNING FIELD-SYMBOL(<fs_alv>).
ls_color-fname = 'COLOR_CODE'.
MOVE <fs_alv>-color_code+(1) TO ls_color-color-col.
MOVE <fs_alv>-color_code+1(1) TO ls_color-color-int.
MOVE <fs_alv>-color_code+2(1) TO ls_color-color-inv.
APPEND ls_color TO <fs_alv>-color.
CLEAR ls_color.
ENDLOOP.
ENDFORM.
2. effect

边栏推荐
- SD card reports an error "error -110 whilst initializing SD card
- 给新人工程师组员的建议
- The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
- 八道超经典指针面试题(三千字详解)
- jsscript
- Erreur de la carte SD "erreur - 110 whilst initialisation de la carte SD
- Quartz misfire missed and compensated execution
- Computer graduation project asp Net fitness management system VS development SQLSERVER database web structure c programming computer web page source code project
- Idea push rejected solution
- 数据分析——seaborn可视化(笔记自用)
猜你喜欢

施努卡:3d视觉检测应用行业 机器视觉3d检测
![Buuctf question brushing notes - [geek challenge 2019] easysql 1](/img/37/c38a933ce7fa5d2b8fa597965ffcb2.png)
Buuctf question brushing notes - [geek challenge 2019] easysql 1

Quartz misfire missed and compensated execution

canvas切积木小游戏代码

【概念】Web 基础概念认知
![BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1](/img/37/c38a933ce7fa5d2b8fa597965ffcb2.png)
BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1

MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置

Recommended foreign websites for programmers to learn
如何做好功能测试

NR modulation 1
随机推荐
Audio-AudioRecord Binder通信机制
3857墨卡托坐标系转换为4326 (WGS84)经纬度坐标
Audio audiorecord binder communication mechanism
StrError & PERROR use yyds dry inventory
Data and Introspection__ dict__ Attributes and__ slots__ attribute
canvas切积木小游戏代码
遥感图像超分辨率论文推荐
[slam] orb-slam3 parsing - track () (3)
Redo file corruption repair
My C language learning record (blue bridge) -- on the pointer
Analyze 菜单分析
Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]
Four logs of MySQL server layer
【SLAM】lidar-camera外参标定(港大MarsLab)无需二维码标定板
深入探究指针及指针类型
NR modulation 1
出现Permission denied的解决办法(750权限谨慎使用)
Pytorch基础——(1)张量(tensor)的初始化
Jenkins basic knowledge ----- detailed explanation of 03pipeline code
记录一下逆向任务管理器的过程