当前位置:网站首页>ALV concept explanation
ALV concept explanation
2022-08-02 23:15:00 【Desolate Moon】
Type pool: SLIS
Fieldcat TYPE slis_t_fieldcat_alv
Function:
Column formatting (form)
Field name, whether the column can be modified, column width, etc.
Layout YEPE slis_layout_alv
Function:
Global formatting (structure)
Whether the entire table field can be modified, whether it is output in zebra pattern, whether to display the selection button field, etc.
Function: REUSE_ALV_FIELDCATALOG_MERGE
Returns fieldcat field structure information according to the internal table structure
Function: REUSE_ALV_GRID_DISPLAY/REUSE_ALV_LIST_DISPLAY
Use GRID/LIST mode to output ALV report
ALV call design content
START-OF-SELECTION
Data form data selection
END-OF-SELECTION
Function:
Assignment to FIELDCAT: set the format of each column
Assignment to LAYOUT: set the form format (Optional)
Assign value to SPRT table, etc.: set sorting content, etc. (optional)
Assign value to EVENT table: add program interaction event (optional)
Call function, output ALV
Case:
REPORT ZHQ_10 MESSAGE-ID ZHQ.INCLUDE ZHQ_10TOP.INCLUDE ZHQ_10FORM.START-OF-SELECTION.PERFORM GET_DATA.ENDOF SELECTION.IF GET_MARD[] IS NOT INITIAL.PERFORM WRITE_DATA.ELSEMESSAGE S001 DISPLAY LIKE 'E'.ENDIF.
FORM WRITE DATA.PERFORM BUILD_FIELDCAT.PERFORM BUILD_LAYOUT.PERFORM BUILD_SORT.PERFORM BUILD_EVEBT.PERFORM BUILD_ALV.ENDFORM.
Create fieldcat
fieldcat is an internal table that records the attribute information of each column when ALV is output
Field Description
KEY Sets the column as a key ('X'/")
ICON Displays as a chart ('X'/")
CHECKBOX Displays as a checkbox ('X'/")
JUST define alignment ('R'/'L'/'C')
IZERO add leading zeros
NO_SIGN do not display sign ('X'/")
NO_ZERO do not displayLeading zeros ('X'/")
COL_POS Output as column number (numeric)
DO_SUM Summarize fields ('X'/")
SELTEXT_L/M/S Field name description long/medium/short(string)
HOTSPOT set as hotspot (displayed as underlined)
Cases
Writing one:
FORM BUILD_FIELDCAT.GS_FIELDCAT-COL_POS = '1'.GS_FIELDCAT-FIELDNAME = 'ZCODE'.GS_FIELDCAT-OUTPUTLEN = '10'.GS_FIELDCAT-SELTEXT_M = 'Student ID'.APPEND GS_FIELDCAT TO GT_FIELDCAT.FORM BUILD_FIELDCAT.GS_FIELDCAT-COL_POS = '2'.GS_FIELDCAT-FIELDNAME = 'ZCODE'.GS_FIELDCAT-OUTPUTLEN = '20'.GS_FIELDCAT-SELTEXT_M = 'Student Name'.APPEND GS_FIELDCAT TO GT_FIELDCAT.ENDFORM.
Writing two: macro related
*macro---up to 9 parameters can be defined in each macroFORM BUILD_FIELDCAT.%%APPEND_FIELDCAT: '1' 'ZCODE' '10' 'Student ID','2' 'ZNAME' '20' 'Name number','3' 'SEX' '3' 'sex','4' 'ZSCHOOL' '10' 'School','5' 'WEIGHT' '15' 'Weight',ENDFORMDEFINE %%APPEND_FIELDCAT. "Usually start with two percent signs, but it is not mandatory, just to distinguish it from other variablesCLEAR GS_FIELDCAT.GS_FIELDCAT-COL_POS = &1.GS_FIELDCAT-FIELDNAME = &2.GS_FIELDCAT-OUTPUTLEN = &3.GS_FIELDCAT-SELTEXT_M = &4.APPEND GS_FIELDCAT TO GT_FIELDCAT.
Using subroutines or macros to add rows to FIELDCAT's internal table
Each column in the form is a row in FIELDCAT
*ALV output parameters
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
GS_FIRLDCAT TYPE SLIS_FIELDCAT_ALV,
FROM BUILD_FIELDCAT.
CLEAR GT_FIELDCAT[].
PERFORM ADD_FIELDCAT USING 'WERKS' 'Factory' '1' '5' ''.
PERFORM ADD_FIELDCAT USING 'LGORT' 'Warehouse' '2''5' ''.
PERFORM ADD_FIELDCAT USING 'WERKS' 'Factory' '3' '20' ''.
PERFORM ADD_FIELDCAT USING 'WERKS' 'Factory' '4' '20' 'X'.
FORM ADD_FIELDCAT USING P_FIELDNAME
P_SELTEXT
P_COL
P_LEN
P_SUM.
CLEAR GS_FIELDCAT.
GS_FIELDCAT-FIELDNAME = P_FIELDNAME. "Field Name
GS_FIELDCAT-SELTEXT_M = P_SELTEXT. "Description text
GS_FIELDCAT-COL_POS = P_COL. "Column
GS_FIELDCAT-OUTPUTLEN = P_LEN. "Output length
GS_FIELDCAT-DO_SUM = P_SUM. "Whether total
APPEND GS_FIELDCAT TO GT_FIELDCAT.
ENDFORM.
Use the function: REUSE_ALV-FIELDCATALOG_MERGE
Function:
Refer to the database (pass the value to I_STRUCTURE_NAME) or refer to the internal table (pass the value to I_INTERNAL_TABNAME), and directly convert the internal table format to the fieldcat form content
NoteThe converted fieldcat may need to be modified again
When ALV is called directly, pass the value data dictionary structure to I_STRUCTURE_NAME
Function:
Can be mixed,
边栏推荐
猜你喜欢
随机推荐
J9数字货币论:识别Web3新的稀缺性:开源开发者
二丙二醇甲醚醋酸酯
Three.js入门
MySQL安装配置教程(超级详细、保姆级)
OP analysis and design
广东省数字经济发展指引 1.0之建成数据安全保障体系
有效解决MySQL报错:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO/YES)
es DELETE index 源码分析
分布式事务
Translate My Wonderful | July Moli Translation Program Winners Announced
新增指令 v-memo
顺序查找和折半查找,看这篇就够了
即时通讯开发移动端网络短连接的优化手段
es 官方诊断工具
对话亚洲高校首个博士论文奖-裘捷中丨KDD2022
ShardingSphere-proxy +PostgreSQL implements read-write separation (static strategy)
ALV报表学习总结
遇上Mysql亿级优化,怎么办
Flutter自带国际化适配自动生成方案
如何ES源码中添加一个自己的API 流程梳理