Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 98
RTUI60
UI Framework Introduction and
UI Development Topics SAP 2007 / Page 2 Unit 1: UI Concepts Unit 2: Business Roles and Navigation Bar Customizing Unit 3: Transaction Launcher Unit 4: UI Config Tool and Design Layer Configuration Unit 5: Factsheet and WebService Tool Unit 6: Business Communication Management Introduction Unit 7: Framework and Customer Enhancements Course Content SAP 2007 / Page 3 Objectives At the end of this unit, you will be able to: Develop a general understanding of the CRM 2007 UI Framework Know key parts of UI Components Explain how navigation takes place within WebClient UI
SAP 2007 / Page 4
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples
Content SAP 2007 / Page 5 Layers of CRM 2007 Applications Tables CRM WebClient Business Server Pages (BSPs) Presentation Layer Business Layer Business Object Layer (BOL) Business Engine (e.g. mySAP CRM) Appl. Progr. Interfaces (APIs) CRM WebClient specific Layers Layers of underlying Business Application Controller Model View Web Browser SAP 2007 / Page 6 CRM WebClient Model View Controller Concept Request Response Controller user input data output View Model Presentation Layer (BSP) Business Layer (BOL & GenIL) Tables Business Engine CRM WebClient set get Data flow Control flow (APIs) SAP 2007 / Page 7 Request Response Controller user input data output View Model * .DO *. HTM Context Context Nodes Method *_ CTXT *_CN01 GET_S_STRUCT Methods: Before Output DO_INIT_CONTEXT PREPARE_OUTPUT After Input DO_HANDLE_DATA DO_HANDLE_EVENT Layout: ABAP/HTMLB-code describing the view layout
e.g. Bus. Partner e.g. Address Address Field Structure DB Tables BOL Class _IMPL Model View Controller in WebClient BSPS SAP 2007 / Page 8 Accessing the Component Workbench Transaction: BSP_WD_CMPWB Choose or create a component to enter the workbench
Do not use the old Workbench BSP_WD_WORKBENCH any more! Test Application field empty: Test component only SAP 2007 / Page 9 Component Workbench: View, Controller and Model Transaction Code BSP_WD_CMPWB View: Layout Controller: Class Model: Context & Context Nodes Controller: Event Handling & Navigation SAP 2007 / Page 10 Component Workbench: Context Nodes, Attributes Context Nodes Context Attributes (Fields) SAP 2007 / Page 11
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples
Content SAP 2007 / Page 12 Layers of CRM 20075.1 Applications Tables CRM WebClient Business Server Pages (BSPs) Presentation Layer Business Layer Business Object Layer (BOL) Business Engine (e.g. mySAP CRM) Appl. Progr. Interfaces (APIs) CRM WebClient specific Layers Layers of underlying Business Application Controller Model View Web Browser SAP 2007 / Page 13 Controller Model Presentation Layer Business Layer Business Engine BOL GenIL View BSP GenIL IMG: Generic Interaction Layer/Object Layer Basic Settings test data retrieval from database to BOL through the GENIL Transaction: GENIL_BOL_BROWSER API API API BOL and GenIL: Tools Display BOL Model Transaction: BSP_WD_CMPWB or GENIL_MODEL_BROWSER SAP 2007 / Page 14 Layers of new UI Framework Presentation Layer (BSP) Layers of underlying Business Application Tables Business Engine (e.g. mySAP CRM) API Interaction Layer (GenIL) Business Layer (BOL) Model Browser: Visualizing BOL Model BOL Browser: Testing Data retrieval from DB to BOL BOL and GenIL: Tools SAP 2007 / Page 15 Definitions 1 Business Object (BO): Smallest unit of an object model with exclusively unstructured attributes. Each BO is assigned a unique name. A BO can be either an access object, a dependent object or a query object. BO instance: Instance of a BO that is uniquely identified by the name of the BO and an identifier (ID). Relation: A relationship between two BOs that is assigned a unique, cross-component name. The relation is assigned a cardinality value for each BO. The navigation direction is a characteristic of the relation. Object model: Number of BOs and their relations.
SAP 2007 / Page 16 Definitions 2 Access Object: An access object is a special type of BO, whose ID can be used to determine both the attributes of the access object itself and those of its dependent objects. Dependent Object: A dependent object is a special type of BO, whose attributes cannot be determined solely from the ID of this BO, but instead, only or together with the ID of the superior access object. Root object: A root object is a special element within a group of objects that are linked to one another in a hierarchy structure via aggregations. The root object is the only object within this structure that is assigned as a superior object to all other objects. Each root object is also an access object. Search-Object: A query object is a special type of BO whose attributes are the parameters of a search request. Dynamic Search-Object: A dynamic query object is a type of BO whose attributes are the parameters of a search request. It is possible to create select options for these parameters. Search Result Object: The result object of a search request is an associated access object at the uppermost level of the hierarchy. SAP 2007 / Page 17 Interface between WebClient UI and underlying DBs SAP 2007 / Page 18 CRM WebClient Model View Controller Concept SAP 2007 / Page 19 Elements Context and Context Node Context Class: Is managing all Context Nodes of a View Creates Context Nodes Connects Context Nodes Context Node: represents a BOL Object has an attribute structure methods for accessing attributes
SAP 2007 / Page 20 Request Response Controller user input data output View Model * .DO *. HTM Context Context Nodes Method *_ CTXT *_CN01 GET_S_STRUCT Methods: Before Output DO_INIT_CONTEXT PREPARE_OUTPUT After Input DO_HANDLE_DATA DO_HANDLE_EVENT Layout: ABAP/HTMLB-code describing the view layout
e.g. Bus. Partner e.g. Address Address Field Structure DB Tables BOL Class _IMPL Model View Controller in WebClient BSPs SAP 2007 / Page 21 Layers of new UI Framework Presentation Layer (BSP) Layers of underlying Business Application Tables Business Engine (e.g. mySAP CRM) API Interaction Layer (GenIL) Business Layer (BOL) Model Browser: Visualizing BOL Model BOL Browser: Testing Data retrieval from DB to BOL BOL and GenIL: Tools SAP 2007 / Page 22
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples
Content SAP 2007 / Page 23 Component Bundle M includes S, H, I Components S Component represents Search functionalites and contains of Search View Search Result View SearchResult Viewset
H Component represents general and specific header data of an object and mostly contains: OverviewPage OV read-only View EF editable Maintenance Views Layout Viewsets
I Component represents general and specific item data of an object and mostly contains: OverviewPage OV read-only View EF editable Maintenance Views Layout Viewsets Components are usually bundled together within a MAIN Component for a specific field of functionality SAP 2007 / Page 24 Component General Parts Main Component M
I P
I P
O P
O P NavBar (Profile) Logical Link Technical ID = (Target-ID) Sub component Search ViewSet View Window I P Search Display
O P Window ViewSet View
I P Sub component Header
O P SAP 2007 / Page 25 Inside and Outside View of a UI Component Inside perspective A component is represented by a component controller has a context that is partially public to the outside A component consists of custom controllers and one or more windows that host the views Outside perspective A component can be (re-)used by one or more other components The embedding component defines a component usage in its runtime repository to formally declare the dependency Also at runtime the component has access to the component usage to get access to the Interface of the embedded component Each component usage gets its own component instance at runtime
Each component could be looked at from the inside as well as from the outside, but what can be seen is different. SAP 2007 / Page 26 Most important Elements of a Component Contains all Views, which should be displayed. Element for Cross-View data transfer Main programming and UI Configuration objects Each component consists of several runtime objects. Most important ones are Windows, Custom Controllers and Views SAP 2007 / Page 27 Technical Implementation of a View Component Elements: - *CTXT Model - *htm View - *IMPL Controller SAP 2007 / Page 28 Elements - Controller Manages Model (Creation Handling) Manages View (Creation, set attributes, lifetime) Does Event handling (e.g. handling for Button clicks) Provides Inbound Plugs (enables Navigation to the view) Provides Outbound Plugs (enables Navigation away from view)
SAP 2007 / Page 29 Elements Context and Context Node Context Class: Is managing all Context Nodes of a View Creates Context Nodes Connects Context Nodes
Context Node: represents a BOL Object has an attribute structure has methods for accessing attributes
SAP 2007 / Page 30 Elements - Window Container which is used for displaying an UI Component can contain Views, ViewSets, etc. (defined in Runtime Repository) similar to a View (has MVC, In- and OutboundPlugs) Window SAP 2007 / Page 31 New Window Concept: Inside and Outside View Inside: (window aspect) Technically a window is a special type of view hosts (serves as root viewset ) views and viewsets of the component has a context that contained views and viewsets can bind to can trigger navigation inside the window Outside: (Interface view aspect) has inbound and outbound plugs as entry and exit points from the view of the embedding component inbound plugs are called when the embedding component navigates to the view can fire an outbound plugs (e.g. if view request so) to request navigation on the level of the embedding component -> navigation destination is determined by embedding component (runtime repository)
Each Window can as well be seen from the inside as well as from the out- side. SAP 2007 / Page 32 Runtime Repository of a Component Each component consists also of several design objects. Most important ones are Navigational Links, Component Interfaces and Component Usages Assignment of Views to Windows Combination of single Views into one Screen Navigation Description Exposition of Component Elements to the Outside Definition of Reusage of other Components SAP 2007 / Page 33 Runtime Repository Each component has its own runtime repository file It acts a a catalogue containing views, viewsets and the composition of views within viewsets Navigational links (with target and source view) Inbound and outbound plugs definitions etc. Technically stored as .xml file Can be displayed and maintained in the Runtime repository editor of the Component workbench
SAP 2007 / Page 34 New Window Concept A Window... is part of a component and defines a root for a hierarchy of viewsets and views in the runtime repository A viewset or view can only be part of exactly one window (still no direct reuse of views) Navigation between views is only possible within a single window . mediates between the embedding and the embedded component during runtime has the character of a view to the inside (window aspect) has the character of a simple view to the outside (interface view aspect) Each component must have one or more windows which are hosting the views SAP 2007 / Page 35 UI-Elements: ViewSet, ViewArea and View ViewSet
ViewArea View ViewArea ViewSet View SAP 2007 / Page 36 Component Interface Needs to be defined if a component shall be reusable is defined in the runtime repository editor Context nodes of component controller are made visible to outside Window is made visible to outside SAP 2007 / Page 37 Component Usage
Components with a component interface can be included in other components (reuse) usages are defined in the runtime repository editor SAP 2007 / Page 38
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples
Content SAP 2007 / Page 39 Concepts of Navigation Navigation from view to view (or component to component) is controlled by several elements. These elements can be used to implement navigation in different ways. Following slides will describe most important elements and strategies that are used to mediate navigation in CRM WebClient.
Navigation describes how to move in WebClient UI and how to link different parts of information about a single object. SAP 2007 / Page 40 Navigation Elements Inbound Plug / Outbound Plug Description of an unique way of entering a view (or a component). You can think of doors to step in or out of a view or a component. IP and OP are methods of regarding view (or windows) controller classes. IP belongs to navigation source. OP belongs to navigation target and contains coding to start Navigation.
Navigational Link Mapping between a specific source with OP and target with IP. You can think of a unique route description for navigation. Consists of an identifier, source + OP, target + IP; is stored in the Runtime Repository of an Component If navigation target is an independent workarea component, navigation is mediated by mapping tables that are part of Navigation Bar Customizing and the Workarea Component Repository.
Events/Eventhandler Method of regarding source controller class, which is starting the navigation after raising an event SAP 2007 / Page 41 Navigation Procedure Navigation Request Event Handling of Request Calling of OutboundPlug Starting Navigation Processing of Inbound Plug ControllerClass of Source View ControllerClass of Target View SAP 2007 / Page 42 Two main Navigation scenarios
Navigation within a Component
Navigation between a Component and a Workarea Component through Navigation Bar In WebClient UI we distinguish between two major navigation scenarios: SAP 2007 / Page 43 Navigation between two Views in one Component Navigation from Service Ticket View to Item Detail View in Component ICCMP_BT_SLT. Service Ticket View Item Detail View Related Navigational Link Outbound Plug Coding in Service Ticket View SAP 2007 / Page 44 Navigation between Workarea Component via Navigation Bar I Navigation from Sales Ticket View to Product Detail View in Component ICCMP_BT_SLT. SAP 2007 / Page 45 Navigation between Workarea Component via Navigation Bar II SAP 2007 / Page 46 Navigation between Workarea Component via Navigation Bar II SAP 2007 / Page 47 Main Navigation scenarios I SAP 2007 / Page 48 Main Navigation scenarios II SAP 2007 / Page 49
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples
Content SAP 2007 / Page 50 Communication between Views Within a Navigation it is necessary to transfer data between source and target View. Communication in here means Data transfer between those Views.
Starting from an OverviewPage you want to display regarding data in a more detailed edit form. But this Edit Form needs to make sure to work on exact the same data context, then it was shown on the Overview Page.
This data transfer within any Navigation is done via so called Controller Bindings. Navigation can only take place if its ensured that it takes places within the same data context. Communication is crucial to achieve a working Navigation SAP 2007 / Page 51 Data Provision: Basis for Data Transfer Context Nodes Context Attributes (Fields) SAP 2007 / Page 52 Custom Controller Presentation Layer (BSP) Controller View 1 Model Context Node Model Context Node Controller View 2 Custom Controller Model Context Node Lifespan Business Layer (BOL, GenIL) Database Lifespan Lifespan SAP 2007 / Page 53 Interface between WebClient UI and underlying DBs SAP 2007 / Page 54 CRM WebClient Model View Controller Concept SAP 2007 / Page 55 Component Controller highest level of all controllers is loaded at initial load of component can serve as data container manages binding of usages manages data transfer between components Binding of Context Node from custom controller to component controller Coding not done by wizard, has to be inserted manually SAP 2007 / Page 56 Controller Levels View View View View Component I View View View View Component H View View View View Component S Component M SAP 2007 / Page 57
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples Enhancement Concepts Creation of Gadget View for Home Page Demo DropDown List Box Demo Search Component Creation Demo
Content SAP 2007 / Page 58 Customer Enhancements View layout configuration Could be achieved via the UI Configuration tool Does not require to leverage the component enhancement concept Used for customer specific layout and label changes (including adding new fields via EEW) Customer and SAP configurations are stored separately Component Enhancements Enhance the functionality of components, views and controllers provided by SAP Modification free via inheritance and using references Uses replacement concept for components at runtime On top of this it is possible to create completely new components
Customer enhancements can be done using the UI Configuration Tool and /or the component enhancement concept SAP 2007 / Page 59 Customer-Specific Fields: Overview Add customer-specific fields Add new fields to the data dictionary (easy enhancement workbench) Use wizard for enhancements Choose a business object Define field name, data type, and field length Dictionary objects are generated automatically Display customer-specific fields on the screen (UI configuration tool) Add fields from field set Position fields Change field labels/hide field labels Set fields to editable or display only Define whether a field should be mandatory
All functions provided by the UI configuration tool for standard fields are also available for customer-specific fields. Use the Design Layer Customizing and/or the BSP WD Component Workbench to implement the following: Drop-down list boxes Value help for your fields Customer-specific fields can easily be added with the easy enhancement workbench. You can use the UI configuration tool to configure these fields. SAP 2007 / Page 60 Component Enhancement Concept I SAP 2007 / Page 61 Component Enhancement Concept II SAP 2007 / Page 62 Component Enhancement Concept III SAP 2007 / Page 63 Define Enhancement Set Configuration: Create an Enhancement Set: Transaction: SM34 View Cluster: BSPWDVC_CMP_EXT The Enhancement Set will be used within the Component Workbench later on. You only need to enter a name and a description. The Enhancement Definition will be filled later on automatically during the enhancements you do in the BSP Component Workbench.
SAP 2007 / Page 64 Assign Enhancement Set to a client Configuration: Assign the Enhancement Set to a client: Transaction: SM30 View: BSPWDV_EHSET_ASG
SAP 2007 / Page 65 Create enhancements I Enhancement: Create an enhancement in the BSP Component Workbench: Transaction: BSP_WD_CMPWB Choose the component you want to enhance and the Enhancement Set. Press the button Enhance Component and enter a name. Choose a Package. (You can create a package in transaction SE80.) Leave the component.
SAP 2007 / Page 66 Create enhancements II Enhancement: Enter the component with your Enhancement Set again. Transaction: BSP_WD_CMPWB All objects that havent yet been enhanced are marked in grey. By right-clicking on an object, you can open a context menu and choose Enhance to enhance the object. The object is created automatically in the customer namespace. SAP 2007 / Page 67 Create enhancements III Enhancement: Now you can enhance the object in the BSP Component Workbench. Enhanced objects are marked in black. The methods are marked with a colored icon: Yellow: Inherited Green: Redefined Red: Not existing In view cluster BSPWDVC_CMP_EXT, the substitution is now visible.
SAP 2007 / Page 68
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples Enhancement Concepts Creation of Gadget on HomePage Demo DropDown List Box Demo
Content SAP 2007 / Page 69 Enhancement Example Gadget Place a gadget from the internet on your homepage in WebClient UI http://www.labpixies.com/gadget_page.php SAP 2007 / Page 70 Enhancement Example Gadget I Create new Component with Gadget View. SAP 2007 / Page 71 Enhancement Example Gadget III Put Gadget Coding from Homepage to View SAP 2007 / Page 72 Enhancement Example Gadget IV Create Component Interface for Widget Component and add View to Window SAP 2007 / Page 73 Enhancement Example Gadget V Create Enhancement Set to enhance Standard Component of Home Page SAP 2007 / Page 74 Enhancement Example Gadget VI Define Component Usage to reuse Widget Component SAP 2007 / Page 75 Enhancement Example Gadget VII Assign new Component Usage to ViewSet of Home Page SAP 2007 / Page 76 Enhancement Example Gadget VIII Do Configuration for Home Page to add Widget View to display SAP 2007 / Page 77 Widget finally added to standard Home Page SAP 2007 / Page 78
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples Enhancement Concepts Creation of Gadget on HomePage Drop Down List Box Demo
Content SAP 2007 / Page 79 Enhancement Example Drop Down Box I Prerequiste for this Example is an existing enhancement done via EEWB and and preconfigured Enhancement Set SAP 2007 / Page 80 Enhancement Example Drop Down Box II Create new Context Node to get access to new Attribute SAP 2007 / Page 81 Enhancement Example Drop Down Box III Create additional Context Node for Dropdown Box Values SAP 2007 / Page 82 Enhancement Example Drop Down Box III Create local class definition and implementation for either 1. Valuehelp via Domain 2. Valuehelp via own valuetable
SAP 2007 / Page 83 Enhancement Example Drop Down Box VI Generate so-called V-Getter Method to implement Valuehelp SAP 2007 / Page 84 Implementation V-Getter Method
Implementation DO_INIT_CONTEXT
Necessary implementation steps Implementation of V-Getter Method and DO_INIT_CONTEXT on Controller Class SAP 2007 / Page 85 Dropdown Box on UI Configuration After implementing V-Getter Method of according attribute, it gets rendered as PickList in UI Config Tool SAP 2007 / Page 86
1. UI Framework Concepts 2. Business Object Layer Introduction 3. Component Development Component Concepts Navigation Concepts Data Communication 4. Customer Enhancement Examples Enhancement Concepts Creation of Gadget on HomePage Demo DropDown List Box Demo Search Component Creation Demo
Content SAP 2007 / Page 87 Creation of Search and Search Result In this example it will be explained how to create a new Component which consists of a Search Page, a Search Result List and a View Set SAP 2007 / Page 88 Creation of Search and Search Result I Following slides will explain step by step what to do to create this Search Component Creation of Search Component Create new Component Create Custom Controller to have component-wide data buffer Create Search Page View with Context Node for search object and Context Node for Search Result Bind Context Nodes to Custom Controller for data transfer Create Search Result List View with Context Node for search results (bound to Customer Controller) and Context Node for data of single selected Search Result SAP 2007 / Page 89 Diagram of Search Component Search BTQ1Order BTQR1Order Z###S Component Controller Main Window Result BTQR1Order BTOrder SearchVS Custom Controller BTQR1Order BTOrder QueryCuCo SAP 2007 / Page 90 Creation of Search and Search Result I Creation of new Component and Creation of Customer Controller Two Context Nodes: One for Search Result Object One for single selected Result Entriy SAP 2007 / Page 91 Creation of Search and Search Result II Creation of Search Page View and binding of Context Node to Custom Controller Two Context Nodes: One for Search Object One for Search Result Object * bind to custom controller
CREATE_RESULT Method: SAP 2007 / Page 92 Creation of Search and Search Result III Creation Search Result List View and binding of Context Node to Custom Controller Two Context Nodes: One for Search Result Object One for single selected entry of Result List * bind to custom controller
CREATE_BTORDER Method: SAP 2007 / Page 93 Creation of Search and Search Result IV Connect Search Result and single selected Result Entry Connect Nodes In Context Class of Search Result View in Method CONNECT_NODES assignment between dependent Context Nodes is done
Whenever RESULT is getting changed the socalled ON_NEW_FOCUS event is called and BTORDER is getting updated
Method CONNECT_NODES of according Context Class SAP 2007 / Page 94 Creation of Search and Search Result V Create coding for starting the search I Trigger Event SEARCH In .htm file of search view adjust coding of table view to add onEnter server event. Layout coding of view file: Search.htm file <%@page language="abap" %> <%@extension name="thtmlb" prefix="thtmlb" %> <thtmlb:advancedSearch id = "advs0" fieldMetadata = "<%= controller->GET_DQUERY_DEFINITIONS( ) %>" header = "<%= Query->get_param_struct_name( ) %>" fieldNames = "<%= controller->GET_POSSIBLE_FIELDS( ) %>" values = "//QUERY/PARAMETERS" onEnter = "SEARCH" ajaxDeltaHandling = "false" /> SAP 2007 / Page 95 Creation of Search and Search Result V Create coding for starting the search I Method CONNECT_NODES of according Context Class method EH_ONSEARCH. DATA: lr_qs TYPE REF TO cl_crm_bol_dquery_service, lr_qr TYPE REF TO if_bol_bo_col, lr_msg_srv TYPE REF TO cl_bsp_wd_message_service.
* do you have any hits ? IF lr_qr->size( ) IS INITIAL. lr_msg_srv = me->view_manager->get_message_service( ). lr_msg_srv->add_message( iv_msg_type = 'I' iv_msg_id = 'CRM_UIU_SEARCH' iv_msg_number = '001' ). ENDIF.
endmethod. Handle Event SEARCH In controller class of search view create eventhandler for event SEARCH and creating coding of search execution SAP 2007 / Page 96 Creation of Search and Search Result V Creation of ViewSet, assignment of Views and assignment to Window Create ViewSet Create ViewSet Layout with one column and two rows
ViewArea Search ViewArea Result Assign Views to ViewSet
SAP 2007 / Page 97 Creation of Search and Search Result VI Assign ViewSet to Window SAP 2007 / Page 98 Lesson Summary This unit covered: General UI Concepts Structure of Component Workbench with its main elements Runtime Repository editor with its elements Introduction to navigation within WebClient UI