ABAP学习(10):ALV显⽰之functionalv
ABAP的ALV
1、Function ALV
调⽤function,传⼊要显⽰的内表,显⽰样式等参数,显⽰alv。
可以调⽤REUSE_ALV_GRID_DISPLAY这个function,也可以调⽤REUSE_ALV_GRID_DISPLAY_LVC这个function,输⼊的参数⼀致,但是⼀些细节传⼊参数类型不同。
REUSE_ALV_GRID_DISPLAY调⽤⽰例:
"调⽤function,显⽰alv
CALL FUNCTION'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = t_outtab EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
View Code
REUSE_ALV_GRID_DISPLAY_LVC调⽤⽰例:
CALL FUNCTION'REUSE_ALV_GRID_DISPLAY_LVC'
* EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* I_CALLBACK_PROGRAM = ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT_LVC =
* IT_FIELDCAT_LVC =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO_LVC =
* IR_SALV_FULLSCREEN_ADAPTER =
* I_YCBN =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = t_outtab
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
View Code
1.1、Function参数解析
I_INTERFACE_CHECK:检查接⼝⼀致性,默认Space;
I_BYPASSING_BUFFER:是否使⽤缓存buffer,类型:字符型1;
I_BUFFER_ACTIVE:是否激活缓存;
I_CALLBACK_PROGRAM:调⽤alv程序名,⼀般就是当前程序,sy-repid,类型:sy-repid,默认Space;
I_CALLBACK_PF_STATUS_SET:ALV⼯具栏Subroutine, ALV屏幕菜单,此参数允许报表展现⽤户⾃定义的屏幕菜单,类型:SLIS_FORMNAME,默认Space,
I_CALLBACK_USER_COMMAND:ALV user Command Subroutine(⼦程序),类型:SLIS_FORMNAME,默认Space;
I_CALLBACK_TOP_OF_PAGE:ALV抬头内容信息,类型:SLIS_FORMNAME,默认Space;
I_CALLBACK_HTML_TOP_OF_PAGE:ALV HTML格式抬头内容信息,类型:SLIS_FORMNAME,默认Space;
I_CALLBACK_HTML_END_OF_LIST:ALV HTML格式页脚内容信息,类型:SLIS_FORMNAME,默认Space;
I_STRUCTURE_NAME:为输出表数据结构的命名,类型:DD02L-TABNAME;
I_BACKGROUND_ID:ALV背景图⽚Object ID,类型:SDYDO_KEY,默认Space;
I_GRID_TITLE: ALV 标题,类型:LVC_TITLE;
I_GRID_SETTINGS:GRID设置信息,类型:LVC_S_GLAY;
IS_LAYOUT_LVC:ALV输出布局样式,类型:LVC_S_LAYO;
IT_FIELDCAT_LVC:设定显⽰的栏位名称及输出设定,类型:LVC_T_FCAT;
IT_EXCLUDING:隐藏设置的ALV⼯具栏,未激活的功能码,类型:SLIS_T_EXTAB;
IT_SPECIAL_GROUPS_LVC:若内表中⼀些字段通过SP_GROUP被分组在⼀起,必须为这些组传递组⽂本内表,类型:
LVC_T_SGRP;
IT_SORT_LVC:ALV排序,类型:LVC_T_SORT;
IT_FILTER_LVC:ALV过滤器,类型:LVC_T_FILT;
IT_HYPERLINK:超链接,类型:LVC_T_HYPE;
IS_SEL_HIDE:替换或修改屏幕中select-option的值,类型:SLIS_SEL_HIDE_ALV;
I_DEFAULT:⽤户是否可以定义默认布局,Space-不可以定义默认布局(默认:X);
I_SAVE: 保存表格布局,’X'-只能保存全局变式;’U'-只能保存特定变式;’A'-都可以保存;Space-不能保存变式(默认:space);
IS_VARIANT:表格布局变式,类型:DISVARIANT;
IT_EVENTS:设置事件,类型为slis_t_event的内表(name:事件名称,form:事件的FORM),类型:SLIS_T_EVENT;
IT_EVENT_EXIT:设置回调的⽅法的执⾏⾏为,表明⽤户所写的代码是在执⾏标准执⾏之前还是之后,类型:SLIS_T_EVENT_EXIT;IS_PRINT_LVC:打印信息,类型:LVC_S_PRNT;
IS_REPREP_ID_LVC:re/re接⼝初始化信息,类型:LVC_S_RPRP;
I_SCREEN_START_COLUMN:对话框形式显⽰开始列,默认:0;
I_SCREEN_START_LINE:对话框形式显⽰开始⾏,默认:0;
I_SCREEN_END_COLUMN:对话框形式显⽰结束列,默认:0;
I_SCREEN_END_LINE:对话框形式显⽰结束⾏,默认:0;
I_HTML_HEIGHT_TOP:HTML抬头的⾼度,类型:I;
I_HTML_HEIGHT_END: HTML页脚的⾼度,类型:I;
IT_ALV_GRAPHICS:是否可以在图表中显⽰ALV,类型:DTC_T_TC;
IT_EXCEPT_QINFO_LVC:Exception的信息,类型:SLIS_T_QINFO_ALV;
IR_SALV_FULLSCREEN_ADAPTER:类型:CL_SALV_FULLSCREEN_ADAPTER;
I_YCBN:类型:char1;
1.2、⾃定义屏幕菜单
使⽤I_CALLBACK_PF_STATUS_SET参数,可以设置⾃定义屏幕菜单。
设置步骤:
1.创建⾃定义status。
2.设置⾃定义菜单的⼦程序form
⽰例:
"⾃定义屏幕菜单
form my_pf_status USING p_extab TYPE slis_t_extab.
set PF-STATUS'ALV_STATUS'.
endform.
parameter数据类型3.设置function输⼊参数I_CALLBACK_PF_STATUS_SET等于⼦程序名,form的名字必须⼤写,不然识别不了。⽰例:
I_CALLBACK_PF_STATUS_SET = 'MY_PF_STATUS'
标准菜单栏
1、没有⾃定义按钮时候,显⽰ALV标准的⼯具栏;
2、当我们使⽤⾃定义按钮后,ALV⾃带的标准按钮,则会失效,这时需要将⼀些必要的按钮在⼯具条补上;
3、其中 “分隔符” 的插⼊⽅法为:选择菜单:Edit->Insert-> Separator line 即可插⼊分隔符;
4、可以快速拷贝标准程序的菜单栏,再进⾏修改、筛选;
通过se80,Repository Information System -> Program Library -> Program Subobjects->GUI Status;
查Program Name:SAPLKKBL;
查STANDARD 或 STANDARD_FULLSCREEN;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论