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
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
二、SAP Control Framework的事件型別System events:該事件發生時,不會發生自動物件的資料交換,不會觸發PBO和PAI事件。在該事件的處理過程裡你可以通過set_new_ok_code 函式設定新值到OK_CODE,人為的觸發PAI和PBO事件。
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 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 | CL_GUI_ALV_GRID | Key Figures - Grid for Key Figures |
CL_BUKF_TERMS_GRID | CL_GUI_ALV_GRID | Key Figures - Grid for terms |
CL_FTR_GUI_ENTRY_ALV | CL_GUI_ALV_GRID | Class: ALV Grid Control for Initial Screen (Without Toolbar) |
CL_GFW_GP_GRID_ALV | CL_GUI_ALV_GRID | ALV grid proxy |
CL_GUI_AQQGRAPHIC_ADAPT | CL_GUI_CONTROL | Network Adapter |
CL_GUI_AQQGRAPHIC_CONTROL | CL_GUI_CONTROL | BW Basis Class Network Control |
CL_GUI_AQQGRAPHIC_NETPLAN | CL_GUI_AQQGRAPHIC_CONTROL | Network Control |
CL_GUI_BARCHART | CL_GUI_CONTROL | Bar chart wrapper |
CL_GUI_BORDERPAINTER | CL_GUI_CONTROL | SAP Border Painter Control Proxy Class |
CL_GUI_BTFEDITOR | CL_GUI_CONTROL | SAP BTF Editor Control Proxy Class |
CL_GUI_CALENDAR | CL_GUI_CONTROL | Calendar Control Proxy Class |
CL_GUI_CHART_ENGINE_WIN | CL_GUI_CONTROL | Graphics: Presentation Graphics (SAP GUI for Windows) |
CL_GUI_CONTAINER | CL_GUI_CONTROL | Abstract Container for GUI Controls |
CL_GUI_CONTAINER_INFO | CL_GUI_CONTAINER | Information on Container Controls |
CL_GUI_CUSTOM_CONTAINER | CL_GUI_CONTAINER | Container for Custom Controls in the Screen Area |
CL_GUI_DIALOGBOX_CONTAINER | CL_GUI_CONTAINER | Container for Custom Controls in the Screen Area |
CL_ECL_VIEWER_FRAME | CL_GUI_DIALOGBOX_CONTAINER | Manage EAI Control in Own Window |
CL_GUI_ECL_VIEWERBOX | CL_GUI_DIALOGBOX_CONTAINER | ECL Viewer as Dialog Box |
CL_GUI_DOCKING_CONTAINER | CL_GUI_CONTAINER | Docking Control Container |
CL_GUI_EASY_SPLITTER_CONTAINER | CL_GUI_CONTAINER | Reduced Version of Splitter Container Control |
CL_EU_EASY_SPLITTER_CONTAINER | CL_GUI_EASY_SPLITTER_CONTAINER | Internal Test; Do Not Use |
CL_GUI_GOS_CONTAINER | CL_GUI_CONTAINER | Generic Object Services Container |
CL_GUI_SIMPLE_CONTAINER | CL_GUI_CONTAINER | Anonymous Container |
CL_GUI_SPLITTER_CONTAINER | CL_GUI_CONTAINER | Splitter Control |
CL_GUI_ECL_2DCOMPARE | CL_GUI_CONTROL | Compare Module for 2D Viewer |
CL_GUI_ECL_3DCOMPARE | CL_GUI_CONTROL | Compare Module for 3D Viewer |
CL_GUI_ECL_3DMEASUREMENT | CL_GUI_CONTROL | Measurement Module for 3D Viewer |
CL_GUI_ECL_3DSECTIONING | CL_GUI_CONTROL | Sectioning Module for 3D Viewer |
CL_GUI_ECL_MARKUP | CL_GUI_CONTROL | Markup (Redlining) Component |
CL_GUI_ECL_PMI | CL_GUI_CONTROL | PMI Module for the 3D Viewer |
CL_GUI_ECL_PRIMARYVIEWER | CL_GUI_CONTROL | Basis Class for ECL Viewers (2D und 3D) |
CL_GUI_ECL_2DVIEWER | CL_GUI_ECL_PRIMARYVIEWER | Engineering Client 2D Viewer |
CL_GUI_ECL_3DVIEWER | CL_GUI_ECL_PRIMARYVIEWER | Engineering Client 3D Viewer |
CL_GUI_ECL_VIEWER | CL_GUI_CONTROL | Proxy Class for Engineering Client Viewer |
CL_GUI_FORMPAINTER | CL_GUI_CONTROL | SAP Form Painter Control Proxy Class |
CL_GUI_GLT | CL_GUI_CONTROL | Internal; Do Not Use! |
CL_GUI_GP | CL_GUI_CONTROL | GFW: Superclass of all graphics proxies |
CL_GUI_GP_GRID | CL_GUI_GP | GFW: Grid proxy |
CL_GUI_GP_HIER | CL_GUI_GP | GFW: Structure graphics |
CL_GUI_GP_PRES | CL_GUI_GP | GFW: Business graphic |
CL_GUI_GRLT | CL_GUI_CONTROL | Internal; Do Not Use !! ( restricted license - see docu) |
CL_GUI_HTML_EDITOR | CL_GUI_CONTROL | HTML Editor |
CL_GUI_ILIDRAGNDROP_CONTROL | CL_GUI_CONTROL | Interactive List: Drag & Drop |
CL_GUI_MOVIE | CL_GUI_CONTROL | SAP Movie Control |
CL_GUI_NETCHART | CL_GUI_CONTROL | Network wrapper |
CL_GFW_GP_HIER_SAP | CL_GUI_NETCHART | GFW: Product-specific section of CL_GUI_GP_HIER (NETZ) |
CL_GUI_PDFVIEWER | CL_GUI_CONTROL | PDF Viewer |
CL_GUI_PICTURE | CL_GUI_CONTROL | SAP Picture Control |
CL_GFW_GP_PRES_WEB | CL_GUI_PICTURE | GFW: product specific section for web view |
CL_GUI_RTF_EDITOR | CL_GUI_CONTROL | SAP SAPscript Editor Control |
CL_GUI_SAPSCRIPT_EDITOR | CL_GUI_RTF_EDITOR | SAP SAPscript Editor Control |
CL_GUI_SELECTOR | CL_GUI_CONTROL | SAPSelector: Control for selecting colors or bitmaps |
CL_GUI_SPH_STATUS_CONTROL | CL_GUI_CONTROL | SAPphone: Status Event Control |
CL_GUI_TABLEPAINTER | CL_GUI_CONTROL | SAP Table Painter Control Proxy Class |
CL_GUI_TIMER | CL_GUI_CONTROL | SAP Timer Control |
CL_GUI_TOOLBAR | CL_GUI_CONTROL | Toolbar Control |
CL_CCMS_AL_GUI_TOOLBAR | CL_GUI_TOOLBAR | Alerts: GUI Toolbar Used in the Visual Framework |
CL_GUI_WCF_WWP | CL_GUI_CONTROL | Internal Tool - DO NOT USE |
CL_KW_AUTOMATION_CONTROL | CL_GUI_CONTROL | Helper Class for General Automation Objects |
CL_LC_EDITOR_CONTROL | CL_GUI_CONTROL | Lifecycle Editor Control |
CL_GCM_LCEDITOR_CONTROL | CL_LC_EDITOR_CONTROL | Control for the display of definition life cycles |
CL_SOTR_SPELLCHECKER | CL_GUI_CONTROL | Interface with OTR Spellchecker |
CL_SRM_BASE_CONTROL | CL_GUI_CONTROL | SRM Control |
CL_SRM_STACKED_CONTROL | CL_SRM_BASE_CONTROL | RM Control with Stack |
CL_TREE_CONTROL_BASE | CL_GUI_CONTROL | Internal Tree Control Class |
CL_GUI_SIMPLE_TREE | CL_TREE_CONTROL_BASE | Simple Tree Control |
CL_ITEM_TREE_CONTROL | CL_TREE_CONTROL_BASE | Internal Tree Control Class |
CL_GUI_COLUMN_TREE | CL_ITEM_TREE_CONTROL | Column Tree Control |
BDMT_CONTROL | CL_GUI_COLUMN_TREE | Administers Tree Control for Monitoring |
CL_BUCC_TREE | CL_GUI_COLUMN_TREE | Consistency Checks - Library Tree |
CL_GFW_COLUMN_TREE | CL_GUI_COLUMN_TREE | Do not use!!!!!!!! |
CL_GFW_GP_HIER_SAPTREE | CL_GFW_COLUMN_TREE | GFW: Product-specific section of CL_GUI_GP_HIER |
CL_HU_COLUMN_TREE | CL_GUI_COLUMN_TREE | Tree that Displays Handling Units |
CL_GUI_LIST_TREE | CL_ITEM_TREE_CONTROL | List Tree Control |
C_OI_CONTAINER_CONTROL_PROXY |