ALV[他律]

2022-03-22 15:20:13 浏览数 (1)

大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说ALV[他律],希望能够帮助大家进步!!!

Function ALV.. 5

Layout结构... 5

Fieldcat结构... 7

ALV相关函数... 9

简单实例... 13

Fieldcat动态创建... 15

通过编程创建... 15

通过REUSE_ALV_FIELDCATALOG_MERGE函数创建... 18

自定义ALV工具条... 20

快速拷贝GUI Status. 23

ALV事件... 24

所支持事件... 25

工具条预置按钮回调出口IT_EVENT_EXIT. 26

颜色... 27

行颜色... 27

列颜色... 30

单元格颜色... 31

可编辑... 33

PushButton

Function ALV

ALV:SAPListViewer

ALV显示格式分为GRID及LIST两种模式,一个以网格显示,另一个以表格显示,两者都有工具栏稍有不同

Layout结构

Layout主要用于设置ALV整体输出格式,为ALV可选项参数。属于类型池 TYPE-POOLS:SLIS

TYPE-POOLS:slis. DATA: layout TYPE slis_layout_alv.

Layout结构所定义的所有字段如下(各字段详细使用说明,可参考REUSE_ALV_GRID_DISPLAY的 is_layout参数文档说明):

代码语言:javascript复制
         no_colhead(1) type c,         " no headings不显示列标题行
         no_hotspot(1) type c,         " headings not as hotspot
         zebra(1) type c,              " striped pattern斑马线显示,颜色隔行交替显示
         no_vline(1) type c,           " columns separated by space不显示垂直网格线
         no_hline(1) type c,        "rows separated by space B20K8A0N5D不显示水平网格线
         cell_merge(1) type c,         " not suppress field replication  ALV单元格中的内容能够复制到剪贴板
edit(1) type c,               " for grid onlyALV是否可编辑,注意只对Grid模式有效,对List模式无效
         edit_mode(1) type c,          " for grid only
         numc_sum(1)     type c,       " totals for NUMC-Fields possib.
         no_input(1) type c,           " only display fields
         f2code like sy-ucomm,       "gs_layout-f2code = '&ETA'.设置触发弹出详细信息窗口的功能码,这里是双击(&ETA)就可以弹出详细窗口,而不需要通过右键菜单
         reprep(1) type c,             " report report interface active
         no_keyfix(1) type c,          " do not fix keycolumns
         expand_all(1) type c,         " Expand all positions
         no_author(1) type c,          " No standard authority check
*        PF-status
         def_status(1) type c,         " default status  space or 'A'
         item_text(20) type c,         " Text for item button
         countfname type lvc_fname,
*        Display options
colwidth_optimize(1) type c, ALV网格(单元格)宽度设置为自动最优化,按输出内容宽度自动调整
         no_min_linesize(1) type c,    " line size = width of the list
         min_linesize like sy-linsz,   " if initial min_linesize = 80
         max_linesize like sy-linsz,   " Default 250
         window_titlebar like sy-title,
         no_uline_hs(1) type c,
*        Exceptions
         lights_fieldname type slis_fieldname," fieldname for exception列显示为红绿灯
         lights_tabname type slis_tabname, " fieldname for exception
         lights_rollname like dfies-rollname," rollname f. exceptiondocu
         lights_condense(1) type c,    " fieldname for exception
*        Sums
         no_sumchoice(1) type c,       " no choice for summing up
         no_totalline(1) type c,       " no total line
         no_subchoice(1) type c,       " no choice for subtotals
         no_subtotals(1) type c,       " no subtotals possible
         no_unit_splitting type c,     " no sep. tot.lines by inh.units
totals_before_items type c,   " diplay totals before the items统计行会在数据行前面显示
totals_only(1) type c,        " show only totals只显示合计
totals_text(60) type c,       " text for 1st col. in total line合计第一列文本
subtotals_text(60) type c,    " text for 1st col. in subtotals
*        Interaction交互
box_fieldname type slis_fieldname, " fieldname for checkbox指定数据内表中哪列以选择按钮形式显示(首列前可按下或弹上来的按钮),ALV最左上角会出现全选按钮
         box_tabname type slis_tabname," tabname for checkbox
         box_rollname like dd03p-rollname," rollname for checkbox
         expand_fieldname type slis_fieldname, " fieldname flag 'expand'
         hotspot_fieldname type slis_fieldname, " fieldname flag hotspot
         confirmation_prompt,          " confirm. prompt when leaving当退出



	

0 人点赞