ABAP--关于SAP Control Framework(入门GUI编程的不错的基础介绍)

本文详细介绍了SAPControlFramework的基本架构及其在客户端和应用服务器端的组成部分,包括AutomationController和ABAPObjectsControlFramework的功能。此外,还阐述了事件类型的划分及事件交互流程,并提供了具体的程序设计步骤。

一、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. 

5)定义事件内表变量
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.
7)创建事件处理类的对象
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 NAMESuper CLASS NAMEDESCRIPTIO
CL_GUI_OBJECT Proxy Class for a GUI Object
CL_FORMPAINTER_BASEWINDOWCL_GUI_OBJECTSAP Form Painter Window Base Class
CL_FORMPAINTER_BITMAPWINDOWCL_FORMPAINTER_BASEWINDOWSAP Form Painter Bitmap Window Class
CL_FORMPAINTER_TEXTWINDOWCL_FORMPAINTER_BASEWINDOWSAP Form Painter Text Window Class
CL_GUI_CONTROLCL_GUI_OBJECTProxy Class for Control in GUI
CL_DSVAS_GUI_BUSIGRAPHCL_GUI_CONTROLDSVAS: Proxy for Business Graphic
CL_GFW_GP_PRES_CHARTCL_GUI_CONTROLGFW: Product-specific section of CL_GUI_GP_PRES (Chart)
CL_GFW_GP_PRES_PIGCL_GUI_CONTROLGFW: product specific section for web view
CL_GFW_GP_PRES_SAPCL_GUI_CONTROLGFW: product-specific section of CL_GUI_GP_PRES (SAP BUSG)
CL_GUI_ALV_GRID_BASECL_GUI_CONTROLBasis Class for ALV Grid
CL_CALENDAR_CONTROL_SCHEDULECL_GUI_ALV_GRID_BASECalendar View (Day, Week, Month)
CL_GUI_ALV_GRIDCL_GUI_ALV_GRID_BASEALV List Viewer
CL_ALV_DD_LISTBOXCL_GUI_ALV_GRIDD&D List Box
CL_BUKF_CAT_GRIDCL_GUI_ALV_GRIDKey Figures - Grid of categories
CL_BUKF_DSRC_GRIDCL_GUI_ALV_GRIDKey Figures - Grid for Data sources
CL_BUKF_FILTER_GRIDCL_GUI_ALV_GRIDKey Figures - Filter for Key Figure
CL_BUKF_KF_GRIDCL_GUI_ALV_GRIDKey Figures - Grid for Key Figures
CL_BUKF_TERMS_GRIDCL_GUI_ALV_GRIDKey Figures - Grid for terms
CL_FTR_GUI_ENTRY_ALVCL_GUI_ALV_GRIDClass: ALV Grid Control for Initial Screen (Without Toolbar)
CL_GFW_GP_GRID_ALVCL_GUI_ALV_GRIDALV grid proxy
CL_GUI_AQQGRAPHIC_ADAPTCL_GUI_CONTROLNetwork Adapter
CL_GUI_AQQGRAPHIC_CONTROLCL_GUI_CONTROLBW Basis Class Network Control
CL_GUI_AQQGRAPHIC_NETPLANCL_GUI_AQQGRAPHIC_CONTROLNetwork Control
CL_GUI_BARCHARTCL_GUI_CONTROLBar chart wrapper
CL_GUI_BORDERPAINTERCL_GUI_CONTROLSAP Border Painter Control Proxy Class
CL_GUI_BTFEDITORCL_GUI_CONTROLSAP BTF Editor Control Proxy Class
CL_GUI_CALENDARCL_GUI_CONTROLCalendar Control Proxy Class
CL_GUI_CHART_ENGINE_WINCL_GUI_CONTROLGraphics: Presentation Graphics (SAP GUI for Windows)
CL_GUI_CONTAINERCL_GUI_CONTROLAbstract Container for GUI Controls
CL_GUI_CONTAINER_INFOCL_GUI_CONTAINERInformation on Container Controls
CL_GUI_CUSTOM_CONTAINERCL_GUI_CONTAINERContainer for Custom Controls in the Screen Area
CL_GUI_DIALOGBOX_CONTAINERCL_GUI_CONTAINERContainer for Custom Controls in the Screen Area
CL_ECL_VIEWER_FRAMECL_GUI_DIALOGBOX_CONTAINERManage EAI Control in Own Window
CL_GUI_ECL_VIEWERBOXCL_GUI_DIALOGBOX_CONTAINERECL Viewer as Dialog Box
CL_GUI_DOCKING_CONTAINERCL_GUI_CONTAINERDocking Control Container
CL_GUI_EASY_SPLITTER_CONTAINERCL_GUI_CONTAINERReduced Version of Splitter Container Control
CL_EU_EASY_SPLITTER_CONTAINERCL_GUI_EASY_SPLITTER_CONTAINERInternal Test; Do Not Use
CL_GUI_GOS_CONTAINERCL_GUI_CONTAINERGeneric Object Services Container
CL_GUI_SIMPLE_CONTAINERCL_GUI_CONTAINERAnonymous Container
CL_GUI_SPLITTER_CONTAINERCL_GUI_CONTAINERSplitter Control
CL_GUI_ECL_2DCOMPARECL_GUI_CONTROLCompare Module for 2D Viewer
CL_GUI_ECL_3DCOMPARECL_GUI_CONTROLCompare Module for 3D Viewer
CL_GUI_ECL_3DMEASUREMENTCL_GUI_CONTROLMeasurement Module for 3D Viewer
CL_GUI_ECL_3DSECTIONINGCL_GUI_CONTROLSectioning Module for 3D Viewer
CL_GUI_ECL_MARKUPCL_GUI_CONTROLMarkup (Redlining) Component
CL_GUI_ECL_PMICL_GUI_CONTROLPMI Module for the 3D Viewer
CL_GUI_ECL_PRIMARYVIEWERCL_GUI_CONTROLBasis Class for ECL Viewers (2D und 3D)
CL_GUI_ECL_2DVIEWERCL_GUI_ECL_PRIMARYVIEWEREngineering Client 2D Viewer
CL_GUI_ECL_3DVIEWERCL_GUI_ECL_PRIMARYVIEWEREngineering Client 3D Viewer
CL_GUI_ECL_VIEWERCL_GUI_CONTROLProxy Class for Engineering Client Viewer
CL_GUI_FORMPAINTERCL_GUI_CONTROLSAP Form Painter Control Proxy Class
CL_GUI_GLTCL_GUI_CONTROLInternal; Do Not Use!
CL_GUI_GPCL_GUI_CONTROLGFW: Superclass of all graphics proxies
CL_GUI_GP_GRIDCL_GUI_GPGFW: Grid proxy
CL_GUI_GP_HIERCL_GUI_GPGFW: Structure graphics
CL_GUI_GP_PRESCL_GUI_GPGFW: Business graphic
CL_GUI_GRLTCL_GUI_CONTROLInternal; Do Not Use !! ( restricted license - see docu)
CL_GUI_HTML_EDITORCL_GUI_CONTROLHTML Editor
CL_GUI_ILIDRAGNDROP_CONTROLCL_GUI_CONTROLInteractive List: Drag & Drop
CL_GUI_MOVIECL_GUI_CONTROLSAP Movie Control
CL_GUI_NETCHARTCL_GUI_CONTROLNetwork wrapper
CL_GFW_GP_HIER_SAPCL_GUI_NETCHARTGFW: Product-specific section of CL_GUI_GP_HIER (NETZ)
CL_GUI_PDFVIEWERCL_GUI_CONTROLPDF Viewer
CL_GUI_PICTURECL_GUI_CONTROLSAP Picture Control
CL_GFW_GP_PRES_WEBCL_GUI_PICTURE
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值