一、SAP Control Framework的架构
SAP Control Framework的架构分为客户端和应用服务器端,其中客户端包含重要的部件:“Automation Controller”,应用服务器端包含:“ABAP Objects Control Framework”;
Automation Controller的功能
1) The automation controller is the central instance at the frontend. It administers all instances of custom controls.
2) The Automation Controller also contains a list of the events that a custom control can trigger .
3) All communication between the controls at the frontend and the application program at the backend runs through the Automation Controller.
ABAP Objects Control Framework的功能
1) The ABAP Objects Control Framework has a similar function at the backend to that of the Automation Controller at the frontend. All method calls from an application program to a custom control run through the Control Framework. In order to avoid each method call establishing a separate connection to the frontend, the method calls are buffered in the automation queue. The automation queue is not sent to the frontend until you reach a synchronization point.
2) Like the Automation Controller, the Control Framework has a list of control events. This list also contains the corresponding handler methods that need to be called when the event occurs .
3) The Control Framework also maintains a list of the control instances you have created. This list is the basis for the lifetime management of controls
二、SAP Control Framework的事件类型
System events:
该事件发生时,不会发生自动对象的数据交换,不会触发PBO和PAI事件。
在该事件的处理过程里你可以通过set_new_ok_code 函数设置新值到OK_CODE,人为的触发PAI和PBO事件。
Application events:
该事件在PAI event处理完后会自动触发(这种情况下屏幕字段已经传输到程序变量),你也可以在PAI事件当中使用CL_GUI_CFW=>DISPATCH 来人为触发Application events事件的处理。
三、SAP Control Framework事件的交互图
先由控件触发事件,“Automation Controller”就会检查是否有该事件的注册,有就会向应用服务器提交,应用服务器就将由“ABAP Objects Control Framework”来检测事件的注册,找出对应处理过程并调用处理
四、SAP Control Framework的程序设计步骤
1)定义事件处理类
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS Event_Handler
FOR EVENT event_name OF cl_gui_picture
IMPORTING event_parameter
sender .
ENDCLASS.
2)事件类实现
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS Event_Handler
FOR EVENT event_name OF cl_gui_picture
IMPORTING event_parameter
sender .
ENDCLASS.3) 定义自定义控件容器变量
DATA container TYPE REF TO cl_gui_custom_container.
4)定义自定义变量
DATA my_control TYPE REF TO cl_gui_picture.
DATA events TYPE cntl_simple_events.
DATA wa_events TYPE cntl_simple_event.
6)定义事件处理类的对象
DATA event_receiver TYPE REF TO lcl_event_receiver.
6)创建容器和控件
CREATE OBJECT container
EXPORTING container_name = 'CUSTOM'
lifetime = lifetime.
CREATE OBJECT my_control
EXPORTING parent = container
lifetime = lifetime.
CREATE OBJECT event_receiver.
8)维护事件内表并注册事件
wa_events-eventid = event_id .
wa_events-appl_event = appl_event . “为X是表示应用类型事件,空表示系统类型事件
APPEND wa_events TO events.
CALL METHOD my_control->set_registered_events
events = events.
9)设置事件处理过程
SET HANDLER event_receiver->Event_Handler
FOR my_control.
五、SAP的GUI的类列表
CLASS NAME | Super CLASS NAME | DESCRIPTIO |
CL_GUI_OBJECT | Proxy Class for a GUI Object | |
CL_FORMPAINTER_BASEWINDOW | CL_GUI_OBJECT | SAP Form Painter Window Base Class |
CL_FORMPAINTER_BITMAPWINDOW | CL_FORMPAINTER_BASEWINDOW | SAP Form Painter Bitmap Window Class |
CL_FORMPAINTER_TEXTWINDOW | CL_FORMPAINTER_BASEWINDOW | SAP Form Painter Text Window Class |
CL_GUI_CONTROL | CL_GUI_OBJECT | Proxy Class for Control in GUI |
CL_DSVAS_GUI_BUSIGRAPH | CL_GUI_CONTROL | DSVAS: Proxy for Business Graphic |
CL_GFW_GP_PRES_CHART | CL_GUI_CONTROL | GFW: Product-specific section of CL_GUI_GP_PRES (Chart) |
CL_GFW_GP_PRES_PIG | CL_GUI_CONTROL | GFW: product specific section for web view |
CL_GFW_GP_PRES_SAP | CL_GUI_CONTROL | GFW: product-specific section of CL_GUI_GP_PRES (SAP BUSG) |
CL_GUI_ALV_GRID_BASE | CL_GUI_CONTROL | Basis Class for ALV Grid |
CL_CALENDAR_CONTROL_SCHEDULE | CL_GUI_ALV_GRID_BASE | Calendar View (Day, Week, Month) |
CL_GUI_ALV_GRID | CL_GUI_ALV_GRID_BASE | ALV List Viewer |
CL_ALV_DD_LISTBOX | CL_GUI_ALV_GRID | D&D List Box |
CL_BUKF_CAT_GRID | CL_GUI_ALV_GRID | Key Figures - Grid of categories |
CL_BUKF_DSRC_GRID | CL_GUI_ALV_GRID | Key Figures - Grid for Data sources |
CL_BUKF_FILTER_GRID | CL_GUI_ALV_GRID | Key Figures - Filter for Key Figure |
CL_BUKF_KF_GRID |