How to Build Web Applications Using MDM Web Dynpro Components
Comments
Description
SAP NetWeaver How-To GuideHow To Build Web Applications Using MDM Web Dynpro Components Applicable Releases: SAP NetWeaver Master Data Management 7.1 Topic Area: Enterprise Information Management Capability: Master Data Management Version 2.10 July 2010 © Copyright 2010 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. These materials are provided “as is” without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. SAP NetWeaver “How-to” Guides are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using SAP NetWeaver. Should you wish to receive additional information, clarification or support, please refer to SAP Consulting. Any software coding and/or code lines / strings (“Code”) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent. Disclaimer Some components of this product are based on Java™. Any code change in these components may cause unpredictable and severe malfunctions and is therefore expressively prohibited, as is any decompilation of these components. Any Java™ Source Code delivered with this product is only to be used by SAP’s Support Services and may not be modified or altered in any way. Document History Document Version 2.10 2.00 Description Terminology updated to reflect changes in the user interface of the MDM Web Dynpro Configuration Manager The How To Consume MDM Web Dynpro Components v1.0 guide has been split into the following two guides: How To Build Web Applications Using MDM Web Dynpro Components Explains how MDM Web Dynpro components are consumed by other custom Web Dynpro components to create a Web Dynpro application with the flexibility to run as a stand-alone application or in a portal environment. This is the guide you are currently reading (as of v2.0). How To Integrate MDM and BPM The guide focuses on how to integrate MDM and Business Process Management (BPM) using MDM Web Dynpro Components and Web Services and is available on SAP Developer Network (SDN) at http://www.sdn.sap.com/irj/sdn/howtoguides. 1.00 First official release of this guide: How To Consume MDM Web Dynpro Components Typographic Conventions Type Style Example Text Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation Example text Emphasized words or phrases in body text, graphic titles, and table titles File and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. User entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER. Icons Icon Description Caution Note or Important Example Recommendation or Tip Example text Example text <Example text> EXAMPLE TEXT Table of Contents 1. 2. 3. 4. 5. 6. 7. 8. 9. Business Scenario .......................................................................................................... 1 Prerequisites.................................................................................................................... 2 Building a Stand-Alone Web Dynpro Application .......................................................... 4 Controlling Field Visibility and Required Properties ................................................... 17 Limiting Lookup Field Values ....................................................................................... 22 Setting Field Default Values in an Item Details Component ........................................ 27 Adding Custom Buttons to an Item Details Component.............................................. 32 Integrating MDM Change Tracker and MDM WD Components .................................... 37 Other Examples ............................................................................................................. 43 9.1 Splitting WD Components into Portal iViews ........................................................... 43 For more information. see Splitting WD Components into Portal iViews on page 43. see http://service. For more information. see Adding Custom Buttons to an Item Details Component on page 32. User Exits allow you to add your own functionality to SAP’s standard business applications without having to modify the original applications. For more information. see How To Integrate Master Data Management (MDM) and Business Process Management (BPM) available on SAP Developer Network (SDN) at http://www. For each custom button you can also add label translations.sap. see Building a Stand-Alone Web Dynpro Application on page 4. MDM Web Dynpro components are also consumed by other custom Web Dynpro components to create a Web Dynpro application which can run as a stand-alone application or in a portal environment.How To Build Web Applications Using MDM Web Dynpro Components 1. so that each component takes on the appearance of an individual portal iView. or read-only). July 2010 1 . In this guide we describe how to build a generic stand-alone Web Dynpro application. For more information.com/irj/sdn/howtoguides. For more information. you can also extend or modify the generic behavior of Web Dynpro components at runtime using User Exits (sometimes called hook methods). see Limiting Lookup Field Values on page 22.sdn. You can set default values for specific fields in an Item Details component so that a user does not have to keep re-entering identical values. Business Scenario SAP NetWeaver Master Data Management (MDM) – Web Dynpro Components MDM Web Dynpro components are consumed (as used components). For more information. see Setting Field Default Values in an Item Details Component on page 27. whether a field is visible. You can limit the list of lookup values in a dropdown list for a specific field to show only those values that are relevant for a particular scenario. However.com/installmdm71 MDM Web Dynpro Components Guide MDM Web Dynpro Components User Exits. There are several different types of User Exits.sap. You can add a customized tool bar with buttons to the user interface of an Item Details component. There are other configuration options that you can implement such as spliting a Web Dynpro application into its components. The following are some examples of how you can apply User Exits for customizing MDM Web Dynpro components at runtime to behave according to a particular use case scenario: You can control the properties of a component (for example. see Controlling Field Visibility and Required Properties on page 17. For more information on User Exits. by custom developed Web Dynpro wrapper applications and can be used for customizing or applying different types of business logic to suit a variety of business scenarios such as Business Process Management (BPM). required. each of which acts as a hook to which you can attach (or hang) your own code. For more information on how MDM Web Dynpro components can be consumed in a BPM process. July 2010 2 .com/installmdm71 MDM Web Dynpro Components Guide Configuring a Project in the MDM WD Configuration Manager.is deployed.sap. MDM JAVA API 7.sap. b.1 7. MDM JAVA WD FRAMEWORK 7. You are using SAP NetWeaver MDM 7. You have run the MDM Web Dynpro Configuration Manager application and configured your components.11 is deployed.The Import Software Component screen opens.1 SP04 or higher.com/installmdm71 MDM Java and .1. For more information. The MDM repository is mounted and loaded. Browse for the MDMJ710<SP-Number>_P<Patch-Number>. see http://service. see http://service.11 SP04 (or higher) and SAP NetWeaver Application Sharing (AS) Java is installed and running..sap. choose the Development Infrastructure perspective as follows: Window Open Perspective Other Development Infrastructure. Before you can develop a Web Dynpro application. see http://service. . SAP NetWeaver Developer Studio (NWDS) is installed and running and is the same version as the SAP NetWeaver AS Java you are running. For more information. see SAP Help Portal at help. For more information. ii. For more information. You have imported the MDM Web Dynpro and MDM Java API software components (SC) to your workspace as follows: a.sca file.sap. Prerequisites You need prior knowledge of Web Dynpro (Java). Import the MDM_JAVA_API softare component to your LocalDevelopment development track as follows: i.com/installmdm71 MDM Web Dynpro Components Guide Deploying the MDM Web Dynpro Components Framework. In the SAP NetWeaver Developer Studio (NWDS). In the context menu of the LocalDevelopment track.How To Build Web Applications Using MDM Web Dynpro Components 2..com. the following must be in place: The SAP NetWeaver Composition Environment (CE) 7.NET API Developer Guide Obtaining the Java API Libraries and Reference and Deploying the Java API and MDM Connector Using JSPM. choose Import SC…. sca file.com/installmdm71 MDM Web Dynpro Components Guide Creating a Destination for the MDM Repository.sap. You import the MDMJAVAWDFRW<SPNumber>_P<Patch-Number>. You have created a Destination to establish a connection to the MDM repository. Add a new dependency to the MyComponents SC. see http://service.How To Build Web Applications Using MDM Web Dynpro Components c. d. July 2010 3 . Two new software components appear in the LocalDevelopment track – MDM_JAVA_API and MDM_JAVA_WD_FRAMEWORK. For more information. for the MDM_JAVA_API and MDM_JAVA_WD FRAMEWORK software components. Import the MDM_JAVA_WD_FRAMEWORK software component to your development track exactly as you did in step b above for the API. .. You are now going to create a new Development Component (DC) Project.. you have to publish their functions in a set of public interfaces called public parts and a dependency to the public part of the DC must be declared. Building a Stand-Alone Web Dynpro Application Important Ensure that you have carried out all the prerequisite steps. July 2010 4 . 1. in the LocalDevelopment track select the MyComponents software component). 2. within which there is a software component called MyComponents. When you declare dependencies.How To Build Web Applications Using MDM Web Dynpro Components 3. you should select only those public parts that your component actually uses. Set the dependencies Info DCs can depend on one another and use each other. Info Local Development is the name of a local development track. Name your Web Dynpro DC project test/masterdc. Choose the software component (SC) where you want the development component (DC) project to be created (that is. Create a new development component (DC) project Info You have already imported the Web Dynpro software component (SC) to your workspace. In the SAP NetWeaver Developer Studio (NWDS). see Prerequisites on page 2. choose the Web Dynpro perspective as follows: File New Web Dynpro Development Component. To enable a DC to use the functionality of another DC. For more information. 3. add dependencies to the Public Parts of the relevant UI components as well as the core ear DC: For example: tc/mdm/wdcomps/core/ear (mandatory) tc/mdm/wdcomps/itemdetails/wd (optional depending on scenario) tc/mdm/wdcomps/resultset/wd (optional depending on scenario) tc/mdm/wdcomps/search/main/wd (optional depending on scenario) July 2010 5 . choose Show In Component Properties. 5. Choose the Development Infrastructure perspective.How To Build Web Applications Using MDM Web Dynpro Components 4. In the Dependencies tab. 6. In the context menu of the test/masterdc DC. mdm4j DC). The name of the DC is also grayed out.sap. Note Uncheck the Build Time checkbox of any DC that has a (red X) next to it.tech.mdm. The red X means that its public parts are for internal use only. Choose Next to configure the dependencies. July 2010 6 . To access these events/methods. 8. Some of the events and interface methods exposed by User Exits use the MDM Java API.How To Build Web Applications Using MDM Web Dynpro Components 7. add a dependency to the MDM Java API (to the api public part of the com. From the Web Dynpro perspective. In the context menu of the Components node.How To Build Web Applications Using MDM Web Dynpro Components Create a new Web Dynpro component 9. expand the test/masterdc Web Dynpro DC project. create a new Web Dynpro component called MasterComp. 10. July 2010 7 . In our example. In the context menu of the MasterComp Web Dynpro component. 11. To achieve this. Choose Component Usage from the Palette area on the right hand side of the screen. Repeat this step for as many components as you need for your scenario. Result Set. July 2010 8 . Drag and drop it onto the work area. To be able to use an external component define component usage as follows: a. Choose Browse to select the required component. and Search components. 13. 12. It is used to graphically define the main application units such as views and controllers. three MDM WD components are referenced: Item Details. b. A New Web Dynpro Component Usage popup window opens. open the Component Data Modeler.How To Build Web Applications Using MDM Web Dynpro Components Info The Component Data Modeler is a graphical Web Dynpro design time tool which is integrated into the Web Dynpro Perspective of the SAP NetWeaver Developer Studio. Info Web Dynpro components can use the data and functionality found within other Web Dynpro components. a usage declaration must be made to establish a parent-child relationship between the two components. Choose Components Name of WD Component. (MasterComp) Windows to open the main MasterCompWindow window. Define the Window Info A Window enables the Web Dynpro component to be seen in a Web browser. 15. July 2010 9 . Create data links between the components you are using and the Component Controller of the MasterComp WD component.How To Build Web Applications Using MDM Web Dynpro Components 14. How To Build Web Applications Using MDM Web Dynpro Components 16. In the Viewsets area of the Palette. GridLayout. Delete the default view. 17. choose. Info You are now going to define the Viewset for the layout of your Web Dynpro application. July 2010 10 . It is within these methods that you may implement your own code. 20. Choose Finish and save the changes. These methods are called automatically when you initialize the Web Dynpro components. July 2010 11 . embed the interface views in the ViewSet cells as follows: Embed View Embed Interface View of a Component Instance. Initialize the components Info Each controller has its own set of standard hook methods. 19.How To Build Web Applications Using MDM Web Dynpro Components 18. In the context menu of GridLayout. Select the relevant interface view. Enter the relevant code in the wdDoInit method: Note When using the setConfiguration method. you need to supply the configuration project name and the component name as defined in the MDM Web Dynpro Configuration Manager (see screen capture below): July 2010 12 . In the Component Controller of the MasterComp WD Component. //@@end 22. initialize the components as follows: Define a variable _repositoryBean of type RepositoryBean in the begin others area //@@begin others RepositoryBean _repositoryBean = null.How To Build Web Applications Using MDM Web Dynpro Components 21. How To Build Web Applications Using MDM Web Dynpro Components July 2010 13 . . see http://service. add the following code to the component’s wdDoExit() method: Note The logoff() method destroys the MDM sessions created by the application. Check the Authentication checkbox. When closing the application. c.com/installmdm71 MDM Web Dynpro Components Guide Defining a Trusted Connection. Create an application for your Web Dynpro DC as follows: .How To Build Web Applications Using MDM Web Dynpro Components Log off 23. 25. choose Create Application. Enter a name. July 2010 14 . a. Open the Web Dynpro perspective.sap. For more information regarding authentication. Important d. In the context menu of the Applications node. Save your changes. 24. for example. b. MasterApp.. 28. Choose Next and select the Master Component as the Web Dynpro component. deploy. and run the new test/masterdc Web Dynpro DC. July 2010 15 . Build.How To Build Web Applications Using MDM Web Dynpro Components 26. 27. Choose Next to select a reference to an existing WD component. How To Build Web Applications Using MDM Web Dynpro Components Result The runtime behavior is as follows: Search Component Result Set Component Item Details Component July 2010 16 . 1. see Prerequisites on page 2. is dependent on another field's values (Country). enter the following values: Se t t e h In step 2. Vendor Region is visible and required. add the following three fields: Vendor.com/installmdm71 MDM Web Dynpro Components Guide Configuring an Item Details Web Dynpro Component. o y ( n l fo rth e Raise Value.. For more information.sap. Country. Note In the Item Details wizard. configure an Item Details WD component. Vendor Region is not applicable. Procedure Important Ensure that you have carried out all the prerequisite steps.How To Build Web Applications Using MDM Web Dynpro Components 4. Using the MDM Web Dynpro Configuration Manager. Configure the Item Details component . and when Country is Japan.True to July 2010 17 . you can control properties of a field on the user interface of an Item Details component by configuring the Raise Event property in the MDM Web Dynpro Configuration Manager.. and Vendor region. Controlling Field Visibility and Required Properties At runtime. When Country is USA. In step 3. For more information. we show you how to configure field visibility when the property of one field (Vendor Region). see http://service. set the Raise Event property to True (only for the Country field). Examples of field properties that you can control are: Visible Read-Only Required In this example. 3. Update the following method properties: Property Name Event Source Subscribed Event Value handleValueChange (any name) The name of the Item Details component that you created in step 1 ValueChanged July 2010 18 . add a new method to the Component Controller of the custom WD wrapper application.How To Build Web Applications Using MDM Web Dynpro Components Configure the Event Handler 2. Choose Event handler as the Method Type. 4. After adding the Item Details component as a used component. How To Build Web Applications Using MDM Web Dynpro Components Result: July 2010 19 . Enter the following values for the Vendor region field properties: Visible = true Required = true Japan is selected from the Country field dropdown list. Enter the following sample code for the handleValueChange method. Enter the following value for the Vendor region field property: Visible = false (Vendor region field will not appear).How To Build Web Applications Using MDM Web Dynpro Components Implement the sample code in the wrapper application 5. July 2010 20 . (Any custom logic can be executed in the Event handler method). In our example: USA is selected from the Country field dropdown list. How To Build Web Applications Using MDM Web Dynpro Components Result The runtime behavior is as follows: When Country = USA. when Country = Japan. the Vendor region cannot be seen on the user interface of the Item Details component. July 2010 21 . However. the Vendor region is visible and set to required * (red asterix). Limiting Lookup Field Values You can limit the list of lookup field values in a dropdown list for a specific field by configuring the Raise Event property in the MDM Web Dynpro Configuration Manager. In addition to the above prerequisites. Using the MDM Web Dynpro Configuration Manager. For more information..sap. Prerequisites Ensure that you have carried out all the prerequisite steps. For more information.com/installmdm71 MDM Web Dynpro Components Guide Configuring an Item Details Web Dynpro Component.. see http://service.How To Build Web Applications Using MDM Web Dynpro Components 5. see Prerequisites on page 2. This example shows you how to limit the values in a dropdown list of a Region field to show only those values that are relevant for a specific country (for example USA). . ensure that: A Vendor record has been created There are two lookup tables: MDM_REGIONS and MDM_COUNTRIES. which are interdependent The Country field in the MDM_REGIONS table is a lookup to the MDM_COUNTRIES table Procedure Configure the Item Details WD component .. 1. July 2010 22 .. configure an Item Details WD component. Update the following method properties: Property Name Event Source Subscribed Event Value valueChangedhandler (can be any name) Select the name of the Item Details component that you created in step 1 above. ValueChanged July 2010 23 . 4. After adding the Item Details component as a used component. Choose Event handler as the Method Type. This raises an event for the Country field value change. 3. add a new method to the Component Controller of the custom WD wrapper. Configure the Event Handler 2. enter the following values: In step 2. add the Country and Vendor region fields. In step 3. set the Raise Event property to True (only for the Countries field).How To Build Web Applications Using MDM Web Dynpro Components Note In the steps of the Item Details wizard. How To Build Web Applications Using MDM Web Dynpro Components Implement the sample code in the wrapper application 5. Example 1 – using a string to limit field values: July 2010 24 . Enter the following sample code for the valueChangedhandler method. Any custom logic can be executed in the event handler method. the Vendor region dropdown list is limited to display only Canadian regions: July 2010 25 .How To Build Web Applications Using MDM Web Dynpro Components Result The runtime behavior is as follows: When you select Country = USA. the Vendor region dropdown list is limited to display only USA relevant regions: When you select Country = Canada. limit the Vendor region dropdown list to include regions with internal Ids 1 and 17. when country = USA. July 2010 26 . For example.How To Build Web Applications Using MDM Web Dynpro Components Example 2 – using an MDM value to limit field values by record Ids: You can also limit the lookup field values to be specific values (MDM internal Ids). If a value does change. Setting Field Default Values in an Item Details Component This example shows you how to define and set default values for fields in an Item Details component. see Prerequisites on page 2. .sap. For more information. In this example. When the user chooses the Create button on the UI of the Item Details component. the default values can be overridden. For more information. This option is used when values are consistent and saves the user from having to keep re-entering the same values. select the following fields: Subject Country Vendor region URL July 2010 27 . Configure the Item Details component ..com/installmdm71 MDM Web Dynpro Components Guide Configuring an Item Details Web Dynpro Component. In the MDM Web Dynpro Configuration Manager.How To Build Web Applications Using MDM Web Dynpro Components 6. see http://service... 1.. Note In step 2 of the Item Details wizard. default values are set for the following four fields: Subject – lookup field to Subjects table Country – lookup field to MDM_COUNTRIES table Vendor region – lookup field to MDM_REGIONS table URL – a standard text field Procedure Important Ensure that you have carried out all the prerequisite steps. configure an Item Details WD component. How is this implemented? A subset of fields in the Item Details component is populated with preconfigured default values. a CreateRecord event is used as the trigger for a hook method and code is executed (a sample code is provided below). How To Build Web Applications Using MDM Web Dynpro Components Field Details Field Name Subject Country Vendor region URL Field Code MDM_MDM_SUBJECT COUNTRY VendorRegion MDM_MDM_URL Lookup Table Subjects MDM_COUNTRIES MDM_REGIONS N/A Lookup Value Brushes USA New York N/A Lookup Value ID 24 11 28 N/A July 2010 28 . the selected lookup value and its internal ID. These are the values that have been selected as the default values for the three lookup fields: July 2010 29 .How To Build Web Applications Using MDM Web Dynpro Components The following screen captures show the MDM Data Manager view of the three lookup tables and for each. How To Build Web Applications Using MDM Web Dynpro Components Configure the Event Handler 2. Choose Event handler as the Method Type. After adding the Item Details component as a used component. 3. add a new method to the Component Controller of the custom WD wrapper. CreateRecord Result showing the new Event Handler method: July 2010 30 . Update the following method properties: Property Name Event Source Subscribed Event Value createRecordHandler (any name) Select the name of the Item Details component you created in step 1 above. 4. The sample code below shows the settings of the following default values: The first is a multi value lookup field. (Any custom logic can be executed in the Event handler method). where a text only value is specified. a URL text field. July 2010 31 . where a multivalue lookup ID is specified. The third and fourth fields (lookup fields). The second.How To Build Web Applications Using MDM Web Dynpro Components Implement the sample code in the wrapper application 5. where the lookup value record ID is specified. Enter the following sample code for the createRecordHandler method. add the Approve and Reject custom buttons in step 5 of the Item Details wizard.. Procedure Important Ensure that you have carried out all prerequisite steps. Adding Custom Buttons to an Item Details Component You would typically use this configuration for controlling a BPM process but it can also be used in a stand-alone custom application. Reject or Approve). Using the MDM Web Dynpro Configuration Manager. 1.How To Build Web Applications Using MDM Web Dynpro Components Result The runtime behavior is as follows: In Create mode. you can add label translations. see Prerequisites on page 2. Configure the Item Details component . the four chosen fields are pre-populated with the default settings. For each custom button. These buttons are visible in a separate row on the UI of the Item Details component (above the standard buttons). give each button a label (multilingual). and insert a unique Status Text (for example.. Using the MDM Web Dynpro Configuration Manager. July 2010 32 . 7. For more information. you can add a customized tool bar with buttons. After adding the Item Details component as a used component. add a new method to the Component Controller of the custom WD wrapper. July 2010 33 .How To Build Web Applications Using MDM Web Dynpro Components Example showing the Reject button: Configure the Event Handler 2. Update the following method properties: Property Name Event Source Subscribed Event Value completeTaskHandler (any name) Select the the Item Details component you created in step 1 above completeTaskEvent July 2010 34 . 4. Choose Event handler as the Method Type.How To Build Web Applications Using MDM Web Dynpro Components 3. Approve or Reject). Note At runtime when you choose any of the custom buttons on the UI of the Item Details component. and the Complete event is fired. the BPMStatus is filled with the values of the Status Text buttons (for example. Map the context by creating and mapping the BPMStatus context attribute of the Item Details component.How To Build Web Applications Using MDM Web Dynpro Components 5. July 2010 35 . In the Data Modeler view. 6. select the data link and choose Edit. the Approve button was chosen. In our example. The same applies for the Reject button. Approve button was pressed is printed by the wrapper application.How To Build Web Applications Using MDM Web Dynpro Components Implement the sample code in the wrapper application 7. A message. Enter the following sample code for the completeTaskHandler method (any custom logic can be executed in the Event handler method). Result The following is the runtime behavior when the Approve button is chosen: The response of the wrapper application to the completeTaskHandler method is: July 2010 36 . Note The names of the configured Project and the Result Set WD component will be used in the wdDoInit() method of your wrapper application. configure an MDM Project and a Result Set WD component. see http://service. However.How To Build Web Applications Using MDM Web Dynpro Components 8. Important The name of the Change Tracker Web Dynpro software component that you import to your workspace is MDM_WEB_UI. Procedure . You have configured a Change Tracker application. July 2010 37 . For more information. to list the selected record’s change history. Using the MDM Web Dynpro Configuration Manager. This example demonstrates how you can define a custom Web Dynpro wrapper application that uses both Result Set and Change Tracker Web Dynpro components. A selectRecord event is fired from the Result Set WD component which passes the record’s internal ID to the Web Dynpro Change Tracker application..sap. Therefore you need to implement a sample code that will convert the internal ID of the selected record to its permanent ID. Prerequisites . see Prerequisites on page 2. Integrating MDM Change Tracker and MDM WD Components The Change Tracker is a Web Dynpro application that provides a user interface for displaying and viewing changes stored in the MDM Change History database. 1.. You have carried out all prerequisite steps.com/installmdm71 MDM Change Tracker Application Guide What is the Configuration Process?. the Change Tracker application expects to receive the record’s permanent ID... For more information. and to the MDM Java API. Create your custom wrapper WD application using the MDM WD Result Set component and the Change Tracker as used components. July 2010 38 . Reference the steps in the following procedure as a guideline: Building a Stand-Alone Web Dynpro Application on page 4.How To Build Web Applications Using MDM Web Dynpro Components 2. the Change Tracker application. We have highlighted some of the changes that you will have to make for this example: When setting the Dependencies include references to the Result Set WD component. getMessageManager(). wdThis. enter the configuration’s Project name and Result Set component name as defined in the MDM Web Dynpro Configuration Manager. When creating an application for your Web Dynpro DC Project.wdGetResultSetInterface(). _userSessionContext = _repositoryBean.setRepositoryBean(_repositoryBean).reportException(e.getUserSessionContext(). you should see the following result: To initialize the components.setConfiguration("Proj01".How To Build Web Applications Using MDM Web Dynpro Components When you have defined the Components Usage for this application. private UserSessionContext _userSessionContext."rs01"). add the following code in the '//@@begin others' area of the Component Controller: private RepositoryBean _repositoryBean. choose your wrapper WD component.getLocalizedMessa ge() Note When using the setConfiguration method. July 2010 39 . wdThis. Add the following sample code to initialize the custom application in the wdDoInit() method: try { _repositoryBean = new RepositoryBean(). } catch (ConfigurationException e) { wdComponentAPI.wdGetResultSetInterface(). add a new method to the Component Controller of the custom WD wrapper application.How To Build Web Applications Using MDM Web Dynpro Components 3. Choose Event handler as the Method Type. July 2010 40 . After adding the Result Set WD component as a used component. Add an Event Handler as follows: a. b. recordSelectionEvent The result is the following newly added Event handler method with a parameter which is the permanent record ID value.How To Build Web Applications Using MDM Web Dynpro Components c. Update the following method properties: Value Name Event Source Subscribed Event Description recordSelectionHandler Select the name of the Result Set component that you configured in step 1 above. July 2010 41 . command.execute(). if(permIds != null && permIds. RepositorySchemaEx schema = MetadataManager.getIdValue()).getTableCode(). command. } catch (ConnectionException e) { wdComponentAPI.length > 0) { int permId = permIds[0].setTableId(tableId).getTableId(tableCode).reportException(e. command.reportException(e. Implement the following sample code in the wrapper application‘s Component Controller.How To Build Web Applications Using MDM Web Dynpro Components d.getMessageManager().wdGetResultSetInterface().selectLookupTable("" + tableId. try { String tableCode = wdThis. } catch (CommandException e) { July 2010 42 .wdGetChangeTrackerInterface().getLocalized Message()).getMessageManager(). getRepositorySchema(_userSessionContext).getPermanentIds().setRecordIds(new RecordId[]{new RecordId(id)}).wdGetChangeTrackerInterface(). wdThis.getInstance(). TableId tableId = schema. GetPermanentIdFromRecordIdCommand command = new GetPermanentIdFromRecordIdCommand(_userSessionContext).setPermanentId(permId). int[] permIds = command. } } catch (SessionException e) { wdComponentAPI.getLocalized Message()). wdThis. getMessageManager().com/installmdm71 MDM Change Tracker Application Guide Creating a Data Source for a JDBC Connector. Configure the components. add the following as a suffix to the URL link that is generated: jdbcAlias=<JDBC_Alias> where JDBC_Alias is the value you have configured as the JDBC alias property name.How To Build Web Applications Using MDM Web Dynpro Components wdComponentAPI. 9.. 9. The Change Tracker application displays the change history of the selected record.reportException(e. we show you how to split a Web Dynpro application into its components.. Select the record in the Result Set WD component. 1.getLocalized Message()).sap. see http://service. After you have built and deployed your wrapper application. so that each component takes on the appearance of an a individual portal iView.1 Other Examples Splitting WD Components into Portal iViews Background In this example. For example http://<Host>:<Port>/webdynpro/dispatcher/<WD_application>?jdbcAlias=< JDBC_Alias> For more information about configuring the JDBC alias property name. } At runtime 4. 5. July 2010 43 . Process There are three main steps: . .How To Build Web Applications Using MDM Web Dynpro Components 2. GridLayout). Info The ViewContainerUIElement offers you options when positioning views in the browser window. Add your custom wrapper WD application using the components as used components. Procedure Configure the components . For more information. July 2010 44 . 3. Using the MDM Web Dynpro Configuration Manager. see Building a Stand-Alone Web Dynpro Application on page 4. 1. Implement the procedure for creating a stand-alone application (some of the steps may not be valid for this example). In the Component Controller of the wrapper application. You can embed this UI element in the layout of an existing view and position it by selecting suitable container layouts (for example. configure the following components: Item Details (name it SplitItemDetails) Result Set (name it SplitResultSet) Search (name it SplitSearch) Add your custom wrapper WD application using the components as used components 2. 3. Add the iViewSplitting property in the application properties and embed the application views in the ViewContainerUIElements.. initialize the MDM repository bean for the three used MDM components (using the project name and component name as keys for the configurations). July 2010 45 . Choose New to edit the wrapper application’s properties.How To Build Web Applications Using MDM Web Dynpro Components Code example: Add the iViewSplitting property 4. 6. Select Predefined as the Type of property. July 2010 46 . Choose Browse to select a predefined application property. Select the iViewSplitting property. 7.How To Build Web Applications Using MDM Web Dynpro Components 5. The result is as follows: July 2010 47 . Set the Value property to true.How To Build Web Applications Using MDM Web Dynpro Components 8. July 2010 48 . 10. Under the Windows node. Repeat the above step three times.How To Build Web Applications Using MDM Web Dynpro Components Embed the application Views in the ViewContainerUIElements 9. Add three ViewContainerUIElements as placeholders for containing the three views of the WD components. The result is as follows: 11. open the SplitToiViewsWindow. July 2010 49 . 15. Copy the Web Dynpro application.How To Build Web Applications Using MDM Web Dynpro Components 12. 14. 16. Log on to Portal as Administrator and from the Top Level Navigation. locate your WD application in the Portal Content role. Drag and drop the Interface View from the Palette and associate the interface view of the three components with the corresponding View element you created in the previous step. 13. Build and deploy the new WD application. Save the changes. Result The new object includes the properties of a Web Dynpro portal page consisting of three Web Dynpro iViews – one for each for the three MDM Web Dynpro components: Portal Page showing Page Content and Layout View July 2010 50 . Select the target folder and Paste as PCD Object.How To Build Web Applications Using MDM Web Dynpro Components 17. How To Build Web Applications Using MDM Web Dynpro Components Portal Page showing the three iViews at runtime July 2010 51 . sdn.www.sap.com/irj/sdn/howtoguides .
Copyright © 2024 DOKUMEN.SITE Inc.