本帖最后由 suogu 于 2019-5-23 16:01 编辑
1、拆分CL_GUI_CONTAINER可以通过使用CL_GUI_SPLITTER_CONTAINER对象的GET_CONTAINER方法获取多个容器对象来实现。
DATA: G_SPLITTER_CONTAINER_1 TYPE REF TO CL_GUI_SPLITTER_CONTAINER.
DATA: MYCONTAINER_1 TYPE REF TO CL_GUI_CONTAINER.
DATA: MYCONTAINER_2 TYPE REF TO CL_GUI_CONTAINER.
CREATE OBJECT G_SPLITTER_CONTAINER_1
EXPORTING
PARENT = CL_GUI_CONTAINER=>SCREEN0
ROWS = 2 “该方法中传入实参ROWS和COLUMNS的值决定你每行跟每列的容器数目
COLUMNS = 1.
CALL METHOD G_SPLITTER_CONTAINER_1->GET_CONTAINER
EXPORTING
ROW = 1 “该方法中传入实参ROW和COLUMNS决定容器在屏幕中所处的相对位置
COLUMN = 1
RECEIVING
CONTAINER = MYCONTAINER_1.
CALL METHOD G_SPLITTER_CONTAINER_1->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = MYCONTAINER_2.
2、在容器中放ALV控件就实现了分屏显示多个ALV控件
DATA: G_GUI_ALV_1 TYPE REF TO CL_GUI_ALV_GRID.
DATA: G_GUI_ALV_2 TYPE REF TO CL_GUI_ALV_GRID.
CREATE OBJECT G_GUI_ALV_1
EXPORTING
I_PARENT = MYCONTAINER_1.
CREATE OBJECT G_GUI_ALV_2
EXPORTING
I_PARENT = MYCONTAINER_2.
*—–省略给ALV展示所需参数赋值……
CALL METHOD G_GUI_ALV_1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = GTH_LAYOUT_UP
CHANGING
IT_OUTTAB = GT_MAT
IT_FIELDCATALOG = GTD_FIELDCAT_UP.