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

来源:互联网 发布:eve mac 国服 2016 编辑:程序博客网 时间:2024/04/29 23:47
  转自:http://blog.csdn.net/CompassButton/archive/2007/10/29/1854631.aspx

一、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_PICTUREGFW: product specific section for web view
CL_GUI_RTF_EDITORCL_GUI_CONTROLSAP SAPscript Editor Control
CL_GUI_SAPSCRIPT_EDITORCL_GUI_RTF_EDITORSAP SAPscript Editor Control
CL_GUI_SELECTORCL_GUI_CONTROLSAPSelector: Control for selecting colors or bitmaps
CL_GUI_SPH_STATUS_CONTROLCL_GUI_CONTROLSAPphone: Status Event Control
CL_GUI_TABLEPAINTERCL_GUI_CONTROLSAP Table Painter Control Proxy Class
CL_GUI_TIMERCL_GUI_CONTROLSAP Timer Control
CL_GUI_TOOLBARCL_GUI_CONTROLToolbar Control
CL_CCMS_AL_GUI_TOOLBARCL_GUI_TOOLBARAlerts: GUI Toolbar Used in the Visual Framework
CL_GUI_WCF_WWPCL_GUI_CONTROLInternal Tool - DO NOT USE
CL_KW_AUTOMATION_CONTROLCL_GUI_CONTROLHelper Class for General Automation Objects
CL_LC_EDITOR_CONTROLCL_GUI_CONTROLLifecycle Editor Control
CL_GCM_LCEDITOR_CONTROLCL_LC_EDITOR_CONTROLControl for the display of definition life cycles
CL_SOTR_SPELLCHECKERCL_GUI_CONTROLInterface with OTR Spellchecker
CL_SRM_BASE_CONTROLCL_GUI_CONTROLSRM Control
CL_SRM_STACKED_CONTROLCL_SRM_BASE_CONTROLRM Control with Stack
CL_TREE_CONTROL_BASECL_GUI_CONTROLInternal Tree Control Class
CL_GUI_SIMPLE_TREECL_TREE_CONTROL_BASESimple Tree Control
CL_ITEM_TREE_CONTROLCL_TREE_CONTROL_BASEInternal Tree Control Class
CL_GUI_COLUMN_TREECL_ITEM_TREE_CONTROLColumn Tree Control
BDMT_CONTROLCL_GUI_COLUMN_TREEAdministers Tree Control for Monitoring
CL_BUCC_TREECL_GUI_COLUMN_TREEConsistency Checks - Library Tree
CL_GFW_COLUMN_TREECL_GUI_COLUMN_TREEDo not use!!!!!!!!
CL_GFW_GP_HIER_SAPTREECL_GFW_COLUMN_TREEGFW: Product-specific section of CL_GUI_GP_HIER
CL_HU_COLUMN_TREECL_GUI_COLUMN_TREETree that Displays Handling Units
CL_GUI_LIST_TREECL_ITEM_TREE_CONTROLList Tree Control
C_OI_CONTAINER_CONTROL_PROXYCL_GUI_CONTROLFor Internal Use
SCE_HTML_CONTROL_EVENT_HANDLERCL_GUI_CONTROLEvent Handler for SCE HTML Control
CL_ALV_TREE_BASECL_GUI_CONTROLBasis Class ALV Tree Control
CL_GUI_ALV_TREECL_ALV_TREE_BASEALV Tree Control
CL_GCM_WORKLIST_TREECL_GUI_ALV_TREECM: Worklist
CL_PT_GUI_TMW_ALV_TREECL_GUI_ALV_TREESmall Modification to CL_GUI_ALV_TREE
CL_GUI_ALV_TREE_SIMPLECL_ALV_TREE_BASESimple ALV Tree
CL_SIMPLE_TREE_VIEW_MMCL_GUI_ALV_TREE_SIMPLESimplest Kind of Tree
CL_GUI_ECATT_RECORDERCL_GUI_CONTROLSAP eCATT Recorder Control - To be used by eCATT only!
CL_GUI_TEXTEDITCL_GUI_CONTROLSAP TextEdit Control
CL_GCM_TEXTEDITCL_GUI_TEXTEDITCM: Long text control
CL_SOTR_TEXTEDITCL_GUI_TEXTEDITEdit Control for the OTR
CL_GUI_HTML_VIEWERCL_GUI_CONTROLHTML Control Proxy Class
CL_BFW_HTML_VIEWER_POCCL_GUI_HTML_VIEWERBrowser Framework: Proxy for HTML Control
CL_CCMS_BSP_VIEWERCL_GUI_HTML_VIEWERHTML Control Proxy Class
CL_CCMS_AL_OBJ_DET_HTML_VIEWERCL_CCMS_BSP_VIEWERAlerts: Component That Displays Object Properties with HTML
CL_CCMS_FROG_HTML_VIEWERCL_GUI_HTML_VIEWERCL_GUI_FROG_HTML_VIEWER
CL_SSF_HTML_VIEWERCL_GUI_HTML_VIEWERSmart Forms: Enhanced HTML Viewer
CL_GUI_ECL_MATRIXCL_GUI_OBJECTRepresents a Complete Data Type with 13 Floats
CL_GUI_RESOURCESCL_GUI_OBJECTGUI Resources (Fonts, Colors, ...)
CL_WF_GUI_RESOURCESCL_GUI_RESOURCESGetting Front Settings
CL_WF_GUI_RESOURCES_4_HTMLCL_GUI_RESOURCESGet Front Settings for HTML Generation
CL_KW_AUTOMATION_OBJECTCL_GUI_OBJECTFor Internal Use
CL_TABLEPAINTER_BASETABLECL_GUI_OBJECTSAP Table Painter Table Base Class
CL_TABLEPAINTER_TABLECL_TABLEPAINTER_BASETABLESAP Table Painter Table Class
CL_TABLEPAINTER_TEMPLATECL_TABLEPAINTER_BASETABLESAP Table Painter Template Class
C_OI_AUTOMATION_OBJECTCL_GUI_OBJECTFor Internal Use
CL_GUI_FRONTEND_SERVICESCL_GUI_OBJECTFrontend services

本篇只是介绍sap的SAP Control Framework基本原理,具体实例大家可以参见:BCALV_GRID_08等等。

原创粉丝点击