1. 程式人生 > >ABAP--關於SAP Control Framework 入門GUI程式設計的不錯的基礎介紹

ABAP--關於SAP Control Framework 入門GUI程式設計的不錯的基礎介紹

               

一、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_nameOF cl_gui_picture    IMPORTING event_parameter              sender. ENDCLASS.2)事件類實現CLASS lcl_event_receiver DEFINITION.PUBLIC SECTION.CLASS-METHODS Event_Handler        FOR EVENT event_nameOF 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_OBJECTProxy 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_PROXY