SAP Control framework
引用:翱翔云天
Make you farmiliar with SAP control framework:
Control framework主要包含兩個組件:
1. CL_GUI_CFW:
這個類里面主要包含一些靜態方法(Static method).
主要組件:
Dispatch:
此方法可以觸發application event,如果不調用這個方法,application event會在PAI處理結束后自動調用。
Flush:
此方法用于同步automation queue。
Get_living_dynpro_controls:
返回所有active customer control。
Set_new_ok_code:
設置一個新的Function code.該方法只能用于system event的handler方法,以此可以觸發PAI處理,然后我們可以對新的ok_code進行處理。
Get_current_event:
獲得當前事件。
2. CL_GUI_OBJECT:
子類:CL_GUI_CONTROL
作用:我覺得最主要的功能是提供一個抽象的接口,里面的方法很少使用。
1. CL_GUI_CONTROL
這個就是我們主要要使用的超類了,先看一下它的子類:
CL_GUI_CONTROL
|_ CL_ALV_TREE_BASE
|_ CL_GUI_ALV_TREE
|_ CL_GUI_ALV_TREE_SIMPLE
|_ CL_GUI_PS_ALV_TREE_SIMPLE
|_ CL_GUI_ALV_GRID_BASE
|_ CL_GUI_ALV_GRID
|_ CL_ALV_DD_LISTBOX
|_ CL_FTR_GUI_ENTRY_ALV
|_ CL_HRPAYNA_GUI_ALV_GRID
|_ CL_CALENDAR_CONTROL_SCHEDULE
|_ CL_GUI_BARCHART
|_ CL_GUI_CALENDAR
|_ CL_GUI_CONTAINER
|_ CL_GUI_CUSTOM_CONTAINER
|_ CL_GUI_DIALOGBOX_CONTAINER
|_ CL_GUI_DOCKING_CONTAINER
|_ CL_GUI_EASY_SPLITTER_CONTAINER
|_ CL_GUI_GOS_CONTAINER
|_ CL_GUI_SPLITTER_CONTAINER
|_ CL_GUI_HTML_VIEWER
|_ CL_BFW_HTML_VIEWER_POC
|_ CL_GUI_PDF_VIEWER
|_ CL_GUI_PICTURE
|_ CL_GFW_GP_PRES_WEB
|_ CL_GUI_TEXTEDIT
|_ CL_GUI_TOOLBAR
|_ CL_TREE_CONTROL_BASE
|_ CL_GUI_SIMPLE_TREE
|_ CL_ITEM_TREE_CONTROL
|_ CL_GUI_COLUMN_TREE
|_ CL_GFW_COLUMN_TREE
|_ CL_HU_COLUMN_TREE
|_ CL_GUI_LIST_TREE
4. 關于事件
4.1兩種類型:
Application event
System event
4.2關于application event使用步驟
-定義數據類型
it_events TYPE cntl_simple_events,
wa_event TYPE cntl_simple_event.
-添加事件
wa_event-eventid = cl_gui_textedit=>event_double_click.
wa_event-appl_event = ‘X’. “Application event
append wa_event to it_events.
-dispatch
CALL METHOD cl_gui_cfw=>dispatch.
4.3 關于system event使用步驟
-定義數據類型
go_event_handler TYPE REF TO cls_event_handler,
gi_events TYPE cntl_simple_events,
g_event TYPE cntl_simple_event.
-定義并且實施event handler類
CLASS cls_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
on_function_selected
FOR EVENT function_selected OF cl_gui_toolbar
IMPORTING fcode,
ENDCLASS.
CLASS cls_event_handler IMPLEMENTATION.METHOD on_function_selected.
……
ENDMETHOD.
ENDCLASS.
-添加事件
?????? g_event-eventid???????? = <system-events>. g_event-appl_event?? = space.??? "This is an system event APPEND g_event TO gi_events.-注冊事件
???????? CALL METHOD go_toolbar->set_registered_eventsEXPORTING events = gi_events.
-創建event handler
CREATE OBJECT go_event_handler.
-設置event handler
???????? SET HANDLER go_event_handler->on_function_selected ?????????? FOR go_toolbar.5. CL_GUI_TEXTEDIT
5.1 Constructor
5.1.1 Text Editor
我們首先考慮如何創建texteditor,所有首先要知道的是constructor方法。
看其參數列表:
MAX_NUMBER_CHARS “能夠插入的最大字符數,可選
STYLE “
WORDWRAP_MODE “換行模式 可選
“0:不換行 1:在邊界換行 2:在固定位置換行
WORDWRAP_POSITION “換行位置,只有WORDWRAP_MODE=2時有效 可選
WORDWRAP_TO_LINEBREAK_MODE “
FILEDROP_MODE “
PARENT “必輸 container
LIFETIME “一般不用 可選
NAME “名字 可選
5.1.2 Custom Container
參數:
PARENT “如果你想container里面包含container,那么這個參數就有用了
CONTAINER_NAME “名字 必輸
STYLE “風格 可選
REPID “使用該container的程序
DYNNR “使用該constainer的屏幕
1.1 步驟
5.2.1 定義一個屏幕100
5.2.2 在100上放一個container,名字為bobo
5.2.3 設置一個pf-status,定義一個退出function key
5.2.4 添加一個ok_code
5.2.5 定義數據類型
data:
custom_container type ref to cl_gui_custom_container,
text_editor type ref to cl_gui_textedit.
5.2.6 在pbo中創建container和text editor
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'BOBO'
CREATE OBJECT TEXT_EDITOR
EXPORTING
WORDWRAP_MODE = 1
PARENT = custom_container
1.1 事件處理
1.1.1 Application event
1).在前面定義的屏幕上加一個輸出字段,以顯示事件類型
2).定義事件所需要的結構以及內表
* Internal table for events that should be registred
i_events TYPE cntl_simple_events,
* Structure for oneline of the table
wa_events TYPE cntl_simple_event.
3).定義event handler
class lcl_event_handler definition.
public section.
class-methods:
catch_dbclick for event dblclick
of cl_gui_textedit importing sender.
endclass.
class lcl_event_handler implementation.
method catch_dbclick.
event_type = 'Event dbclick Raised!'.
endmethod.
endclass.
Note:該如何確定control里面都有什么事件呢?常用的event列表如下:
DBLCLICK
double click
F1
F1 pressed
F4
F4 pressed
CONTEXT_MENU
Context Menu requested (by pressing right mouse)
CONTEXT_MENU_SELECTED
Context Menu item selected
ON_DROP
drop occured
ON_DRAG
drag occured
ON_DROP_COMPLETE
complete drag and drop operation
4).在創建text editor之后注冊事件
* Link the event handler method to the event and the
* TextEdit control
* 注意,因為是靜態方法,所以用=>
SET HANDLER lcl_event_handler=>catch_dbclick FOR text_editor.
* Register the event in the internal table i_events
wa_events-eventid = cl_gui_textedit=>event_double_click.
wa_events-appl_event = 'X'. "This is an application event
append wa_events to i_events.
* Pass the table to the TextEdit control using method
* set_registred_events
call method text_editor->set_registered_events
exporting events = i_events.
5).測試程序效果
雙擊之后:
1.1.1 System event
基本上和application event差不多,只需要注意以下幾點:
1).appl_event = space
2).不需要cl_gui_cfw=>Dispatch
3).需要重新設置ok_code
????? call method cl_gui_cfw=>set_new_ok_code ??????? exporting new_code = 'XXX'.4).需要重新處理新設置的OK_CODE
CASE OK_CODE.
WHEN ‘XXX’.
……
ENDCASE.
1.2 調用方法
1.2.1 可調用常用方法列表
SET_REGISTERED_EVENTS
注冊事件
CONSTRUCTOR
創建對象的時候調用
DELETE_TEXT
刪除所有文本
EMPTY_UNDO_BUFFER
清空UNDO緩存
FIND_AND_REPLACE
查找替換
FIND_AND_SELECT_TEXT
查找
GET_LINE_TEXT
取得某行的文本
GET_SELECTED_TEXT_AS_R3TABLE
把選擇的文本放到內表中
GET_SELECTED_TEXT_AS_STREAM
get selected text as stream
GET_SELECTION_INDEXES
get absolute character indexes of selection
GET_SELECTION_POS
獲得選擇文本的位置
GET_TEXT_AS_R3TABLE
把文本放到內表
GET_TEXT_AS_STREAM
get whole text as stream from control (incl. "\r" and "\n")
GO_TO_LINE
跳到某一884C
HIGHLIGHT_LINES
高亮顯示設定的行
HIGHLIGHT_SELECTION
把選擇的文本高亮顯示
INDENT_LINES
定義縮進的行
INDENT_SELECTION
對所選內容縮進
MAKE_SELECTION_VISIBLE
OPEN_LOCAL_FILE
打開本地文件,一般已經集成在toolbar里面了
PROTECT_LINES
set protect mode for a range of lines
PROTECT_SELECTION
set protect mode for selection
REGISTER_EVENT_CONTEXT_MENU
registration for event context menu
REGISTER_EVENT_DBLCLICK
registration for event double-click
REGISTER_EVENT_F1
registration for event key F1 pressed
REGISTER_EVENT_F4
registration for event key F4 pressed
REGISTER_EVENT_FILEDROP
egistration for event file dropped
REPLACE_ALL
replace all
SAVE_AS_LOCAL_FILE
save as local file
SELECT_LINES
select area of lines, not necessarily within visible part
SET_AUTOINDENT_MODE
set auto indent behavior on or off
SET_COMMENTS_STRING
set string which indicates the whole line is a comment
SET_FILEDROP_MODE
set file drop mode of TextEdit control
SET_FIRST_VISIBLE_LINE
SET_HIGHLIGHT_COMMENTS_MODE
SET_READONLY_MODE
set TextEdit control 'read only' flag true or flase
SET_SPACES_ON_INDENT
set number of spaces to use for indenting and unindenting
SET_SELECTION_POS
set text selection within control
SET_SELECTION_POS_IN_LINE
set selection to a certain line and position
SET_SELECTION_INDEXES
set selection using character indexes
SET_STATUS_TEXT
set status text in status bar of control
SET_TOOLBAR_MODE
set toolbar visibility of TextEdit control
SET_WORDBREAK_PROCEDURE
set wordbreak procedure
SET_WORDWRAP_BEHAVIOR
set wordwrap behavior of TextEdit control
UNINDENT_LINES
unindent a range of lines
UNINDENT_SELECTION
unindent selected text area
SET_NAVIGATE_ON_DBLCLICK
set navigate on double-click mode of TextEdit control
COMMENT_LINES
change a range of lines into comments
COMMENT_SELECTION
change a selected number of lines into comments
UNCOMMENT_LINES
uncomment a range of lines
UNCOMMENT_SELECTION
uncomment a selceted number of lines
DISPLAY_CONTEXT_MENU
display context menu
REGISTER_EVENT
event registration
UNREGISTER_EVENT
event registration
REGISTER_DRAGDROP
register at control framework for drag & drop
1.1.1 如何調用方法
我們以set_text_as_r3table為例介紹一下具體的步驟:
1).在前面的例子的屏幕上放置一個按鈕,名字IMPORT,OK_CODE:IMP
2).定義一個call_meth類,里面包含load_text方法
class call_meth definition.
public section.
types:
begin of t_texttab,
line(255) type c,
end of t_texttab.
data:
i_texttab type table of t_texttab.
methods:
load_text.
private section.
methods:
add_data.
endclass.
class call_meth implementation.
method add_data.
* Create internal table with texts
APPEND 'This a method that fills the TextEdit control' TO i_texttab.
APPEND 'with a text.' TO i_texttab.
DO 10 TIMES.
APPEND 'hallo world !' TO i_texttab.
ENDDO.
endmethod.
method load_text.
Call method add_data.
* Load TextEdit control with texts
CALL METHOD text_editor->set_text_as_r3table
EXPORTING table = i_texttab.
IF sy-subrc > 0.
* Display an error message
EXIT.
ENDIF.
endmethod.
endclass.
3).調用flush方法,同步
* All methods that operates on controls are transferred to the frontend
* by a RFC calls. the method FLUSH is used
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc > 0.
* Display an error message
ENDIF.
4).在ok_code的處理的時候調用call_met->load_text
when 'IMP'.
create object call_meth_ref.
call method call_meth_ref->load_text.
5).測試結果:
點擊import之后:
注意:因為每次調用的時候都會創建call_meth對象,所以會重新添加記錄到內表,這樣就避免了每次都要clear內表。
1.1 更多的方法和事件
我們上面用到了幾個方法,分別是:
SET_TEXT_AS_R3TABLE:這個方法把內表中的數據發送到text control中
SET_TEXT_AS_STREAM: 這個基本和SET_TEXT_AS_R3TABLE差不多
SET_REGISTERED_EVENTS:注冊事件
下面我們再介紹幾個常用的方法:
5.5.1 GET_REGISTERED_EVENTS
參數:
EVENTS Type CNTL_SIMPLE_EVENTS
這個方法從CL_GUI_CONTROL繼承而來,沒有重新定義,作用是得到當前已經注冊的事件,小例子如下:
定義數據:
data:
rg_events type CNTL_SIMPLE_EVENTS.
定義方法:
class call_meth definition.
public section.
types:
begin of t_texttab,
line(255) type c,
end of t_texttab.
data:
i_texttab type table of t_texttab.
data:
rg_events type CNTL_SIMPLE_EVENTS.
methods:
load_text,
load_events.
private section.
data:
indicator type c.
methods:
add_data importing ind type c.
endclass.
class call_meth implementation.
method add_data.
data: begin of rtab,
e_name(50) type c,
e_type(20) type c,
end of rtab.
data: itab like table of rtab.
data: r_event type CNTL_SIMPLE_EVENT.
case ind.
when '1'.
* Create internal table with texts
APPEND 'This a method that fills the TextEdit control'
TO i_texttab.
APPEND 'with a text.' TO i_texttab.
DO 10 TIMES.
APPEND 'hallo world !' TO i_texttab.
ENDDO.
when '2'.
call method text_editor->GET_REGISTERED_EVENTS
importing events = rg_events.
loop at rg_events into r_event.
case r_event-eventid.
when -601.
rtab-e_name = 'EVENT_DOUBLE_CLICK'.
when 2.
when 0.
when 1.
when 5.
when 6.
when 3.
rtab-e_name = 'EVENT_F1'.
when others.
endcase.
if r_event-appl_event = space.
rtab-e_type = 'System Event'.
else.
rtab-e_type = 'Application Event'.
endif.
append rtab to itab.
endloop.
call method text_editor->SET_TEXT_AS_STREAM
exporting TEXT = itab.
when others.
endcase.
endmethod.
method load_text.
call method add_data exporting ind = '1'.
* Load TextEdit control with texts
CALL METHOD text_editor->set_text_as_r3table
EXPORTING table = i_texttab.
IF sy-subrc > 0.
* Display an error message
EXIT.
ENDIF.
* All methods that operates on controls are transferred to the frontend
* by a RFC calls. the method FLUSH is used to determine when this is don
CALL METHOD cl_gui_cfw=>flush.
IF sy-subrc > 0.
* Display an error message
ENDIF.
endmethod.
method load_events.
call method add_data exporting ind = '2'.
call method cl_gui_cfw=>flush.
endmethod.
endclass.
定義OK_CODE處理
when 'IMP'.
if call_meth_ref is initial.
create object call_meth_ref.
call method call_meth_ref->load_text.
else.
call method call_meth_ref->load_text.
endif.
when 'GRE'.
if call_meth_ref is initial.
create object call_meth_ref.
call method call_meth_ref->load_events.
else.
call method call_meth_ref->load_events.
endif.
5.5.2 GET_SELECTION_POS和SET_SELECTION_POS
定義屏幕字段:
定義數據:
data:
fline type i,
tline type i,
fpos type i,
tpos type i,
gfline type i,
gtline type i,
gfpos type i,
gtpos type i.
處理ok_code:
when 'SSP'.
CALL METHOD text_editor->SET_SELECTION_POS
EXPORTING
FROM_LINE = fline
FROM_POS = fpos
TO_LINE = tline
TO_POS = tpos
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
others = 2
.
when 'GSP'.
CALL METHOD text_editor->GET_SELECTION_POS
IMPORTING
FROM_LINE = gfline
FROM_POS = gfpos
TO_LINE = gtline
TO_POS = gtpos
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
others = 2
.
5.5.3 SET_READONLY_MODE
這個方法設置text editor為只讀模式,你在創建好text editor之后調用就可以。
CALL METHOD TEXT_EDITOR->SET_READONLY_MODE
EXPORTING
READONLY_MODE = 1 “0:可以修改 1:只讀
EXCEPTIONS
ERROR_CNTL_CALL_METHOD = 1
INVALID_PARAMETER = 2
others = 3 .
1.1 總結
因為text editor比較簡單,而且使用的不是很頻繁,所以就不多介紹,估計這些也就夠用了。
1. CL_GUI_SPLITTER_CONTAINER
這個類相對就簡單太多了,主要功能就是container的拆分。
6.1首先我們先看看它的幾個常用的方法:
CONSTRUCTOR:構造方法
主要參數:
PARENT -- Parent Container
ROWS –需要顯示多少行,舉例,你想把container分成上下兩個部分,那么rows = 2
COLUMNS – 需要分成多少列
接下來主要是一些setter和getter方法
SET_BORDER 設置邊框的格式,space:不設置 ‘X’:設置
效果如圖:
Space:
‘X’:
SET_ROW_HEIGHT — GET_ROW_HEIGHT 用來設置行的高度
SET_COLUMN_WIDTH - GET_COLUMN_WIDTH 設置列的寬度
SET_ROW_MODE - GET_ROW_MODE 設置行的模式
SET_COLUMN_MODE - GET_COLUMN_MODE 設置列的模式
下面這四個方法原理一樣,主要設置splitter的屬性,例如能不能移動等等
SET_ROW_SASH - GET_ROW_SASH
SET_COLUMN_SASH - GET_COLUMN_SASH
6.2 小例子
我們就以前面介紹的texteditor來舉例,在一個container中添加3個texteditor
6.2.1 創建屏幕,定義一下ok_code就可以了
6.2.2 定義類以及方法
首先初始化屏幕
*創建第一個splitter,水平分割初始化的cl_gui_container
create object splitter_h
exporting parent = cl_gui_container=>screen0
rows = 1
columns = 2.
* 設置邊框
CALL METHOD splitter_h->SET_BORDER
EXPORTING
BORDER = 'X' “有邊框的
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
* 設置模式
CALL METHOD splitter_h->SET_COLUMN_MODE
EXPORTING
MODE = 0
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
* 設置屬性
CALL METHOD splitter_h->SET_COLUMN_SASH
EXPORTING
ID = 1
TYPE = splitter_h->TYPE_MOVABLE
VALUE = 0
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
*設置列的寬度
CALL METHOD splitter_h->SET_COLUMN_WIDTH
EXPORTING
ID = 1
WIDTH = 300
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
* 取得分開后的兩個container
container_left = splitter_h->get_container( row = 1 column = 1 ).
container_right = splitter_h->get_container( row = 1 column = 2 ).
* 然后分割右邊的container
create object splitter_v
exporting parent = container_right
rows = 2
columns = 1.
CALL METHOD splitter_v->SET_BORDER
EXPORTING
BORDER = 'X'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3 .
CALL METHOD splitter_v->SET_row_MODE
EXPORTING
MODE = splitter_v->mode_absolute
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3 .
CALL METHOD splitter_v->SET_row_height
EXPORTING
ID = 1
height = 150
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3 .
* 取得分割右邊container后的兩個container
container_top = splitter_v->get_container( row = 1 column = 1 ).
container_bottom = splitter_v->get_container( row = 2 column = 1 ).
endmethod.
6.2.3 往已經分割好的container中添加texteditor
method add_control.
CREATE OBJECT editor_1
EXPORTING
PARENT = container_left .
CREATE OBJECT editor_2
EXPORTING
PARENT = container_top .
CREATE OBJECT editor_3
EXPORTING
PARENT = container_bottom .
endmethod.
6.2.4 測試程序代碼
REPORT ZBOBO_SPLITER_CONTROL .
data: con type ref to cl_gui_container.
DATA OK_CODE LIKE SY-UCOMM.
class create_screen definition create private.
public section.
class-methods:
init_screen.
methods:
constructor,
add_control.
private section.
data:
splitter_h type ref to cl_gui_splitter_container,
splitter_v type ref to cl_gui_splitter_container,
container_left type ref to cl_gui_container,
container_right type ref to cl_gui_container,
container_top type ref to cl_gui_container,
container_bottom type ref to cl_gui_container,
editor_1 type ref to cl_gui_textedit,
editor_2 type ref to cl_gui_textedit,
editor_3 type ref to cl_gui_textedit.
methods:
fill_data.
endclass.
class create_screen implementation.
method init_screen.
data: screen type ref to create_screen.
create object screen.
endmethod.
method constructor.
data:
events type cntl_simple_events,
event type cntl_simple_event.
* container_left type ref to cl_gui_container,
* container_right type ref to cl_gui_container.
* container_top type ref to cl_gui_container,
* container_bottom type ref to cl_gui_container.
create object splitter_h
exporting parent = cl_gui_container=>screen0
rows = 1
columns = 2.
CALL METHOD splitter_h->SET_BORDER
EXPORTING
BORDER = 'X'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
CALL METHOD splitter_h->SET_COLUMN_MODE
EXPORTING
MODE = 0
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
CALL METHOD splitter_h->SET_COLUMN_SASH
EXPORTING
ID = 1
TYPE = splitter_h->TYPE_MOVABLE
VALUE = 0
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
CALL METHOD splitter_h->SET_COLUMN_WIDTH
EXPORTING
ID = 1
WIDTH = 300
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
container_left = splitter_h->get_container( row = 1 column = 1 ).
container_right = splitter_h->get_container( row = 1 column = 2 ).
create object splitter_v
exporting parent = container_right
rows = 2
columns = 1.
CALL METHOD splitter_v->SET_BORDER
EXPORTING
BORDER = 'X'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
CALL METHOD splitter_v->SET_row_MODE
EXPORTING
MODE = splitter_v->mode_absolute
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
CALL METHOD splitter_v->SET_row_height
EXPORTING
ID = 1
height = 150
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
others = 3
.
container_top = splitter_v->get_container( row = 1 column = 1 ).
container_bottom = splitter_v->get_container( row = 2 column = 1 ).
call method add_control.
endmethod.
method add_control.
CREATE OBJECT editor_1
EXPORTING
PARENT = container_left .
CREATE OBJECT editor_2
EXPORTING
PARENT = container_top .
CREATE OBJECT editor_3
EXPORTING
PARENT = container_bottom .
endmethod.
method fill_data.
endmethod.
endclass.
start-of-selection.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_100'.
* SET TITLEBAR 'xxx'.
CALL METHOD CREATE_SCREEN=>INIT_SCREEN.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
6.2.5 測試結果如圖:
6.2.6 更深探討
我們把整個屏幕都分了,那么能不能我們只分割一個customer_container呢?
答案是當然可以,我們首先放一個customer container到屏幕上,然后創建custom container,然后在此基礎上分割custom container.
創建屏幕:
添加代碼:
data: con type ref to cl_gui_custom_container.
CREATE OBJECT con
EXPORTING
CONTAINER_NAME = 'BOBO' .
create object splitter_h
exporting parent = con
rows = 1
columns = 2.
看看效果:
到此splitter control介紹完畢。
轉載于:https://www.cnblogs.com/wequst/archive/2009/06/29/1513347.html
總結
以上是生活随笔為你收集整理的SAP Control framework的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 5万块最聪明的理财方式 可以选择这几种
- 下一篇: 上不了网,我的解决过程