1、效果如下
选择屏幕点击执行->显示公司报表
公司报表点击radio button带出下面工厂和库存报表
2、屏幕设计
2.1选择屏幕
" 新建屏幕9002 注意:这里要 选择屏幕
SELECTION-SCREEN BEGIN OF SCREEN 9002 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_bukrs FOR t001-bukrs.
SELECTION-SCREEN END OF BLOCK bk1.
SELECTION-SCREEN END OF SCREEN 9002.
2.2主屏幕
PROCESS BEFORE OUTPUT.
MODULE STATUS_9001.
"调用选择屏幕
CALL SUBSCREEN SUB1 INCLUDING SY-REPID '9002'.
"初始化ALV参数
MODULE INIT_ALV.
PROCESS AFTER INPUT.
"不加这句 则拿不到9002屏幕上的数据
CALL SUBSCREEN SUB1.
MODULE USER_COMMAND_9001.
3、初始化docking和container
3.1 变量声明
DATA: gc_docking1 TYPE REF TO cl_gui_docking_container, " docking container 主
gc_docking2 TYPE REF TO cl_gui_docking_container,
gc_splitter TYPE REF TO cl_gui_easy_splitter_container,
gc_container1 TYPE REF TO cl_gui_container,
gc_container2 TYPE REF TO cl_gui_container,
gc_alv1 TYPE REF TO cl_gui_alv_grid,
gc_alv2 TYPE REF TO cl_gui_alv_grid,
gc_alv3 TYPE REF TO cl_gui_alv_grid.
3.2 初始化docking
"创建工厂和库存报表docking容器,在屏幕下方
"通过 gc_docking1->SET_WIDTH 和 gc_docking1->SET_HEIGHT 来设置宽高
CREATE OBJECT gc_docking1
EXPORTING
parent = cl_gui_container=>default_screen
repid = sy-repid
dynnr = '9001'
side = cl_gui_docking_container=>dock_at_bottom
extension = 250.
"创建splitter容器,其父容器是docking1
CREATE OBJECT gc_splitter
EXPORTING
parent = gc_docking1
orientation = 1.
"获取splitter 左和右容器
gc_container1 = gc_splitter->top_left_container.
gc_container2 = gc_splitter->bottom_right_container.
"创建公司报表docking容器,在屏幕右侧
CREATE OBJECT gc_docking2
EXPORTING
parent = cl_gui_container=>default_screen
repid = sy-repid
dynnr = '9001'
side = cl_gui_docking_container=>dock_at_right
extension = 800.
3.3 初始化alv
"指定i_parent即可
CREATE OBJECT gc_alv3
EXPORTING
i_parent = gc_docking2.
CREATE OBJECT gc_alv1
EXPORTING
i_parent = gc_container1.
CREATE OBJECT gc_alv2
EXPORTING
i_parent = gc_container2.
4、其余都是常规OO ALV操作,不再赘述
注意点:
1、radio需要在类型里设置为 char04
2、需要在fieldcat里设置radio可edit编辑、icon显示、hotspot点击
3、初始化radio icon: icon_wd_radio_button_empty
4、点击后的radio icon: icon_radiobutton
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/17986.html