Extending Extending_SRM_Web_Dynpro_ViewSRM Web Dynpro View

Embed Size (px)

DESCRIPTION

Extending_SRM_Web_Dynpro_View

Citation preview

  • Extending an SAP SRM 2007 Web Dynpro View

  • Table of Contents

    Extending an SAP SRM 2007 Web Dynpro View ................................... i

    Table of Contents .................................................................................... ii

    1 Creating an Enhancement Containing One or Several Fields....... iii

    Creating or Selecting an Enhancement Implementation................................... iii

    Creating Context Attributes for the Fields .......................................................... v

    Adding Labels and Fields to the Web Dynpro View .......................................... vi

    Adding a Label to the Web Dynpro View................................................................................vi

    Adding a Field to the Web Dynpro View ................................................................................vii

    Binding a Label to the Field....................................................................................................vii

    Binding a Field to the Context Attribute ...............................................................................viii

    Activating Changes .............................................................................................. ix

    Defining Field Metadata ....................................................................................... ix

    Suppressing Standard Display of Customer Fields ........................................... x

    2 Personalization................................................................................. xii

    3 Appendix .......................................................................................... xiii

    Finding the Right Web Dynpro Component and View..................................... xiii

    Overview of Basic Data Views on the SAP SRM 2007 Web Dynpro UI........... xiv

    Overview Which Generic Framework is Implemented in Which SupportPackage ................................................................................................................ xv

    Copyright ................................................................................................................................xvi

    SAP - Important Disclaimers............................................................................. xvii

    Coding samples.....................................................................................................................xvii

    Internet hyperlinks.................................................................................................................xvii

    Accessibility...........................................................................................................................xvii

  • SAP Supplier Relationship Management 6.0 (SAP SRM 2007) is based on Web Dynpro UItechnology and enhancement framework. This combination allows developers of add-ons andcustomer enhancements to extend and adapt SAP SRM screens, called Web Dynpro views,according to their needs without modifications.

    Enhancing a Web Dynpro view allows you to create new UI elements. This procedure is similarto the development of the components. All UI elements created within the enhancementimplementation are handled the same way as Web Dynpro UI elements during runtime.

    A customer field extension framework is implemented in SAP SRM 2007. The customer or add-on must append the fields to the header or item structures of a business object. The frameworkthen dynamically generates fields on the UI on the basic data tabs on header and item level ofmost business objects.

    1 Creating an Enhancement Containing One orSeveral FieldsIf the customer field extension framework either does not exist for a certain business objecttype, or it is not sufficient for your needs, you can extend an existing Web Dynpro viewcomponent by adding new fields. For example, the basic data tab on the item level of theshopping cart can be extended by adding new fields using a Web Dynpro enhancementimplementation. In the following example we describe how to add an input field, a checkboxand a dropdown list box to a Web Dynpro view.

    To display a Web Dynpro view, proceed as follows:

    1. From the ABAP Workbench, start the Object Navigator transaction (SE80).

    2. Select Web-Dynpro-Comp./Intf. From the input help.

    3. Select a component, for example, /SAPSRM/WDC_DODC_SC_I_BD (Component forShopping Cart Item).

    4. Double-click the view in which you want to add fields, for example, V_DODC_SC_I_BD.Note: A Web Dynpro component may have more than one view.

    Creating or Selecting an Enhancement ImplementationThe first time you extend a Web Dynpro view with new fields, a new enhancementimplementation must be created or an existing to be selected.

  • Figure 1: Creation of a New Enhancement Implementation

    To create an enhancement implementation, double-click1 the view or controller in which youwant to perform the enhancement (see Figure 1). You can then open a creation dialog for anew enhancement implementation or see a list of all existing enhancement implementations forthis component2. You can ignore the next dialog screen unless you are using switchedpackages. For more information about switches, see the Switch Framework Documentation.

    Figure 2: Assignment of a Switch to an Enhancement Implementation

    If the implementation has already been created, you need to change the view to enhancemode. The view displays the status and the enhancement status as either Active or Inactive(see Figure 3). This automatically directs you to the Layout tab page of the view.

    Figure 3: Status of the Enhancement in View Editor

    1 The function Create/Change of an enhancement implementation is only available to you if theoriginal component is in display mode. If you switch from display mode to change mode, theoriginal component itself will be ready for change, so therefore no enhancement implementationcan be created or changed and the icon is grayed out.

    2 We recommend that you add a namespace prefix to the name of the enhancementimplementation. The names of objects that you create in this enhancement implementationshould also begin with this namespace2 prefix. Make sure you use the customer namespace forthe enhancement implementation, as well as for the UI elements.

  • The Layout tab page shows the layout structure (see Figure 4). The layout structure consists ofa main container, the ROOTUIELEMENTCONTAINER, and several sub-containers.Containers structure the layout of the application, for example, grouping related fields together.

    Figure 4: Structure of the View Layout of the Shopping Cart Basic Item Data Tab

    Creating Context Attributes for the FieldsEach element3 of a Web Dynpro view is always bound to a context element ( A context fields).Each context has a hierarchical structure. It contains a root node CONTEXT and the differentcontext elements are arranged below it. A context element or node consists of an arrangementof attributes assigned from a DDIC structure or manually added. Each view contains a datacontainer which displays the data in the view (see Figure 5). This data container is called aview context.

    Figure 5 Web Dynpro View Contexts

    The application data is structured and stored in the view context. This data, for example, isprovided by the SRM system and is displayed in the view. It can be predefined or dataelements can be filled by user input. Other context elements are used for the internal structureof the context.

    Before new elements are going to be added to a Web Dynpro View, it must be first checked ifthe corresponding context fields to bind these elements already exist in the context. To check ifnew context attributes for the fields need to be created:

    3 A element could be an input field, a check box or a dropdown list box

  • 1. Select the Context tab on the view editor4.

    2. Select the desired context tree and find the required attributes. For the shopping cart, selectthe node ITEM_BASIC_DATA.

    Figure 6: Adding Attributes to the View Context Node

    If the required attributes are not in the context tree, they must be added to the context fromDDIC. To add attributes from the DDIC structure to the view context node, use the wizard (seeFigure 6). You can then select the components or attributes of the structure5 to be added to theview context. When you confirm the selected attributes, they are automatically assigned to theview context.6

    Figure 7: Selecting Attributes From the Underlying DDIC Structure

    Adding Labels and Fields to the Web Dynpro ViewYou can add new fields from the DDIC to the selected enhancement implementation.

    To add several fields with labels to a Web Dynpro component, you must create a label and afield before creating more labels.. The following steps apply to each field.

    Adding a Label to the Web Dynpro ViewTo insert a label element to a Web Dynpro view, proceed as follows:

    4 The view editor is also called UI Designer.5 It is not possible to include any attributes in a node that do not correspond to a component of theselected structure.6 The added attributes seen in Figure 7 are dummy fields used in this example and are not standarddelivery. However these have been appended in the customer included structure of the shopping cart.

  • 1. Open the context menu of the container in which the fields are inserted, for example,LEFT_CONTAINER,.

    2. Choose Insert Element.

    3. Enter the name of the element, for example, "ZZINPUT_FIELD_LABEL".

    4. Select Label from the input help for the Type field.

    5. Choose Confirm Selection in the dialog box.

    Adding a Field to the Web Dynpro ViewTo add fields to the Web Dynpro view, proceed as follows:

    1. Select the context menu of the selected container and choose Insert Element.

    2. Enter a name for the input field, for example, "ZZINPUT_FIELD".

    3. Select Input Field from the input help for the Type field.

    4. Choose Confirm Selection in the dialog box.

    Figure 8: Adding New Elements to a Web Dynpro View

    Binding a Label to the FieldTo bind labels to the fields you add to Web Dynpro views:

    1. Select the Label element from the element list.

    2. From the input help for the LabelFor line in the properties table, choose the InputFieldelement that you created, in this case, ZZINPUT_FIELD. The ZZINPUT_FIELD_LABEL isnow bound to the input field7.

    7 As the new elements have been added as an enhancement to a Web Dynpro view, you willsee the name of your enhancement implementation in the Erweiterung (Extension) property ofeach added element. Therefore, you will only able to edit these enhancement fields in theenhancement mode of the corresponding implementation.

  • To display the fields together, set the layout data property of the element label toMatrixHeadData and the layout property of the element ZZINPUT_FIELD_LABEL toMatrixData.

    For an indicator or dropdown list box element with corresponding labels repeat steps 1.3.1.to1.3.38.

    Figure 9: Overview of the Newly Added Elements

    The labels text boxes are empty (see Figure 9). You can enter your own text in the propertyText. If left blank the label can be taken over from the bound field in the Web Dynpro contextas described in the next step.

    Binding a Field to the Context AttributeAs shown in the previous paragraphs, UI elements have inherent properties. Each UI elementfor the transfer or display of data contains one property that describes user input or the sourceof the data to be displayed.

    These properties can be defined at design time by specifying a fixed value or referring to acontext element. Alternatively, you can bind them to a context element. In this case, thecontext element value is displayed at runtime, or the input field content is passed from thescreen to the context element of the view element.

    Data binding of a UI element property is set up in the view layout. In the Binding column of theproperties table of the embedded UI elements, choose to open a dialog box, whichprovides the context structure of the corresponding view for an element selection.

    Figure 10: Binding the New Element to the View Context Item Basic and View in Browser

    8 It is important to note that for SAP NetWeaver support packages prior to SAP NetWeaverSP13, the enhancement framework does not support moving enhanced Web Dynpro viewelements to non-standard places. It might be possible to move the UI elements within the view,but you may not achieve the desired result . Therefore, do not move the enhanced fields to adifferent place than where they were created by default in the Web Dynpro view in SAP SRM2007 support packages prior to SAP SRM 2007 SP04.

  • The new elements are bound to the attributes of the view context. It is not necessary to bind alabel to view context as it is bound by default to the medium field label of the correspondingDDIC data type9 of the attribute. You can change the binding of the labels text property byselecting the type of character you require, for example, Long Text (see Figure 11).

    Figure 11: Changing the Binding of the Text Property of a Label

    Activating ChangesTo activate the changes you have made, save your changes and activate the component. TheWeb Dynpro framework first activates the enhancement and then the component. Theelements are displayed in the LEFT_CONTAINER and automatically checked when the youchange from display to change mode, or they are a displayed as a required field.

    Defining Field MetadataYou must define field metadata to make elements or fields visible on a Web Dynpro ABAP UI.To configure metadata for header and item fields, start the Call View Maintenance transaction(SM30) and call one of the following views:

    ? /SAPSRM/V_MDF_HC (Customer Metadata Configuration for Header Fields)? /SAPSRM/V_MDF_IC (Customer Metadata Configuration of Item Fields)

    For example, metadata can be configured for item fields in the view /SAPSRM/V_MDF_IT. Youcan enter additional data to make the field visible on the UI. You must enter a field name andthe business object type. You do not have to enter data for the other four key fields: subtype,transaction type (process type), item type, and item process type.

    9 Note: The text of a label element is normally determined by the bound data type of the element towhich the label points. If the element has a data type assigned where the same field label is left blank,no text will be displayed for it on the label. In this case, change the binding property of the label textor, if necessary, add your own text directly in the field of the labels text property.

  • Figure 12: Metadata Configuration of Item Fields and View in Browser

    You can enter data for each new element (field) on the UI, and each element can have morethan one entry. If several entries for the same element exist that correspond to the same key,the most specific one takes precedence. Entries in the tables should be as generic as possible.

    For more information about metadata configuration, see the SAP SRM 2007 SP03Implementation Guide (IMG) and the corresponding Solution Manager content. SAP SRM 2007SP02 customers, see SAP Note 1103956.

    Suppressing Standard Display of Customer FieldsIt is sometimes necessary that a certain generic customer field not be displayed in a WebDynpro view10 so that it can be used in another view, for example, another tab11. In this case,the fields standard display needs to be suppressed from the current view. You can suppress afield using the metadata framework setting for the field, however, metadata can be only setglobally for a customer field and therefore cannot be set for a specific Web Dynpro view. Themetadata is always necessary for displaying the field, regardless of the view12. To suppress13the standard display of customer fields in a view, maintain an entry for the desired field in theview /SAPSRM/V_WD_FLD. To suppress a field, proceed as follows:

    1. Create a new entry (see Figure 13).

    2. Choose Exclusive from the Inclusive/Exclusive option on the Configuration for Generic Displayof Extension Fields on WD tab14. This stops the framework from generating this field on theUI.

    10 For example, the view of the tab for the Item Basic Data Tab of the Shopping Cart11 The generic display of customer fields is only available in some Web Dynpro View. For moreinformation, see chapter 3.3. This is only a technical point of view regarding the layout. Before addinga field to another view, it must be checked to see if a context field for binding already exists.12 If we set metadata to make a customer field invisible, it would mean that this field is suppressed inall views of the certain business object for within a specific scope.13 This option prevents fields appended in a customer include structure from being processed by thestandard display of customer fields.14If you do not select Inclusive/Exclusive, the entry will be ignored.

  • Figure 13: Suppress a Customer Field from Being Displayed

    To customize the sequence of customer fields and their horizontal alignment, or to change theorder in which customer fields appear15, proceed as follows:

    1. Create a new entry or use an existing one.

    2. On the Configuration for Generic Display of Extension Fields on WD tab, enter a numericvalue between -9 and +9 in the Sequence field. Entering a lower sequence number for a fieldwill cause the field to be displayed with a higher sequence value. Similarly, a highersequence causes a field to be displayed with a lower sequence value.

    3. Choose Inclusive from the Inclusive/Exclusive option.

    4. To customize the alignment16 of a customer field, select an alignment setting from theHorizontal Alignment input help (see Figure 14).

    Figure 14: Customizing the Sequence and Alignment of a Customer Field

    15 It is not possible to change the display sequence of core fields.16 If Horizontal Alignment displays 0, the alignment is set to auto.

  • 2Personalization

    Personalization allows you to adjust the application to suit your requirements or preferences.,You can personalize your application directly from within the application. There are feweroptions for variation in personalization than in Configuration. This ensures that personalsettings do not restrict the run capability of the application.

    Settings can be personalized for individuals or groups. A system administrator can processpersonalization settings on the basis of his or her extended authorization when the applicationis running in configuration mode.

    For more information, see Personalization see SAP Help Portal at http://help.sap.com -> WebDynpro for ABAP -> End User and Administrator Personalization or read SAP Note 1109666(How to activate Web Dynpro Customizing).

  • Appendix

    Finding the Right Web Dynpro Component and ViewThe next chapter gives you an overview of the basic data views on the SAP SRM 2007 WebDynpro UI.

    To find a required Web Dynpro component or name, proceed as follows:

    1. On the UI select Enhanced, and in the context menu, select More Field Help. A popupappears displaying the technical information for a UI element.

    2. In the popup, under General Information About the Application and Component, you can findthe Web Dynpro component name and associated views (see Figure 16).

    Figure 15: Finding the Right Component on the UI

    To find technical information about a field, proceed as follows:

    1. Select More Field Help from the context menu. A popup appears displaying the functionalfield description and its usage.

    2. In the popup, select Technical Help. The technical information for the field Product ID isdisplayed (see Figure 16).

    Figure 16: Technical Help for the Field Product ID of the Shopping Cart Item Basic DataView

  • Overview of Basic Data Views on the SAP SRM 2007 WebDynpro UI

    Overview of on basic data views on SRM 6.0 Web Dynpro UIBusiness Object Scope Web Dynpro Component

    Header /SAPSRM/WDC_DODC_ASL_H_BDItem /SAPSRM/WDC_DODC_ASL_S_GD

    SC(Shopping Cart) Header /SAPSRM/WDC_UI_SC_DOFC_HDItem /SAPSRM/WDC_DODC_SC_I_BD

    PO(Purchase Order) Header /SAPSRM/WDC_DODC_PO_H_BD1Overview /SAPSRM/WDC_PO_DOFC_OV_HD

    Item /SAPSRM/WDC_DODC_PO_I_BDCTR(Contract) Header /SAPSRM/WDC_CTR_DODC_H_BD

    Overview /SAPSRM/WDC_CTR_DOFC_OV_HItem /SAPSRM/WDC_CTR_DODC_I_BD

    INV(Invoicing) Header /SAPSRM/WDC_DODC_INV_H_BDOverview /SAPSRM/WDC_DODC_INV_O_BDItem /SAPSRM/WDC_DODC_INV_I_BD

    AUC(Auction) Header /SAPSRM/WDC_DODC_AUC_H_BDItem /SAPSRM/WDC_DODC_AUC_I_BD

    CONF(Confirmation) Header /SAPSRM/WDC_DODC_CONF_HBDItem /SAPSRM/WDC_DODC_CONF_IBD

    POR(POR) Header /SAPSRM/WDC_DODC_POR_H_BDOverview /SAPSRM/WDC_DODC_POR_O_BDItem /SAPSRM/WDC_DODC_POR_I_BD

    QTA(Quote Arrangement) Header /SAPSRM/WDC_DODC_QTA_C_GDItem /SAPSRM/WDC_DODC_QTA_H_GD

    QTE(Quote) Header /SAPSRM/WDC_DODC_QTE_H_BDItem /SAPSRM/WDC_DODC_QTE_I_BD

    RFQ(Bid Invitation) Header /SAPSRM/WDC_DODC_RFQ_H_BDItem /SAPSRM/WDC_DODC_RFQ_I_BD

  • Overview Which Generic Framework is Implemented inWhich Support Package

    FrameworksSP02 SP03

    Business Object Scope MDCEF

    TE MD

    CEF

    TE NDF

    ASL(PO. Response ) Header X XItem X X X

    SC(Shopping Cart) HeaderItem X X X X X X X

    PO(Purchase Order) Header X X X X X XOverview X XItem X X X X X X X

    CTR(Contract) Header X X X X XOverview X XItem X X X X X

    INV(Invoicing) Header X X X XOverview X XItem X X X X

    AUC(Auction) Header X X X X X XItem X X X X X X

    CONF(Confirmation) Header X X X X X X XItem X X X X X X X

    POR(POR) Header X X X XOverview X X XItem X X X X

    QTA(Qoute Arrangement) Header X X X X XItem X X X X X

    QTE(Quote) Header X X X X X XItem X X X X X X

    RFQ(Bid Invitation) Header X X X X X XItem X X X X X X

    MD Metadata Framework

    CEF Customer Extension FieldFramework

    TE Table Extension Framework

    NDF Non-Database Display FieldFramework

  • Copyright

    Copyright 2007 SAP AG. All rights reserved. ?

    SAP document classification: PUBLIC

    No part of this publication may be reproduced or transmitted in any form or for any purposewithout the express permission of SAP AG. The information contained herein may be changedwithout prior notice.Some software products marketed by SAP AG and its distributors contain proprietarysoftware components of other software vendors.

    Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of MicrosoftCorporation.

    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, and Informix are trademarks or registered trademarks of IBMCorporation 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 aretrademarks or registered trademarks of Citrix Systems, Inc.

    HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C, WorldWide 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 fortechnology 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 productsand services mentioned herein as well as their respective logos are trademarks or registeredtrademarks of SAP AG in Germany and in several other countries all over the world. Allother product and service names mentioned are the trademarks of their respectivecompanies. Data contained in this document serves information purposes only. Nationalproduct specifications may vary.

    These materials are subject to change without notice. These materials are provided bySAP AG and its affiliated companies ("SAP Group") for informational purposes only, withoutrepresentation or warranty of any kind, and SAP Group shall not be liable for errors oromissions with respect to the materials. The only warranties for SAP Group products andservices are those that are set forth in the express warranty statements accompanying suchproducts and services, if any. Nothing herein should be construed as constituting anadditional warranty.

  • SAP - Important Disclaimers

    SAP document classification: PUBLIC

    This document is for informational purposes only. Its content is subject to change withoutnotice, and SAP does not warrant that it is error-free. SAP MAKES NO WARRANTIES,EXPRESS OR IMPLIED, OR OF MERCHANTABILITY, OR FITNESS FOR A PARTICULARPURPOSE.

    Coding samplesAny software coding and/or code lines / strings ("Code") included in this documentation are onlyexamples and are not intended to be used in a productive system environment. The Code isonly intended better explain and visualize the syntax and phrasing rules of certain coding. SAPdoes not warrant the correctness and completeness of the Code given herein, and SAP shallnot be liable for errors or damages caused by the usage of the Code, except if such damageswere caused by SAP intentionally or grossly negligent.

    Internet hyperlinksThe SAP documentation may contain hyperlinks to the Internet. These hyperlinks are intendedto serve as a hint where to find supplementary documentation. SAP does not warrant theavailability and correctness of such supplementary documentation or the ability to serve for aparticular purpose. SAP shall not be liable for any damages caused by the use of suchdocumentation unless such damages have been caused by SAP's gross negligence or willfulmisconduct.

    AccessibilityThe information contained in the SAP Library documentation represents SAP's current view ofaccessibility criteria as of the date of publication; it is in no way intended to be a bindingguideline on how to ensure accessibility of software products. SAP specifically disclaims anyliability with respect to this document and no contractual obligations or commitments areformed either directly or indirectly by this document. This document is for internal use only andmay not be circulated or distributed outside your organization without SAP's prior writtenauthorization.

  • Extending an SAP SRM 2007 Web Dynpro ViewTable of ContentsExtending an SAP SRM 2007 Web Dynpro ViewiTable of Contentsii1Creating an Enhancement Containing One or Several FieldsiiiCreating or Selecting an Enhancement ImplementationiiiCreating Context Attributes for the FieldsvAdding Labels and Fields to the Web Dynpro ViewviAdding a Label to the Web Dynpro ViewviAdding a Field to the Web Dynpro ViewviiBinding a Label to the FieldviiBinding a Field to the Context AttributeviiiActivating ChangesixDefining Field MetadataixSuppressing Standard Display of Customer Fieldsx2Personalizationxii3AppendixxiiiFinding the Right Web Dynpro Component and ViewxiiiOverview of Basic Data Views on the SAP SRM 2007 Web Dynpro UIxivOverview Which Generic Framework is Implemented in Which Support PackagexvCopyrightxviSAP - Important DisclaimersxviiCoding samplesxviiInternet hyperlinksxviiAccessibilityxvii1 Creating an Enhancement Containing One or Several FieldsCreating or Selecting an Enhancement ImplementationCreating Context Attributes for the FieldsAdding Labels and Fields to the Web Dynpro ViewActivating ChangesDefining Field MetadataSuppressing Standard Display of Customer Fields

    2 PersonalizationAppendixFinding the Right Web Dynpro Component and ViewOverview of Basic Data Views on the SAP SRM 2007 Web Dynpro UIOverview Which Generic Framework is Implemented in Which Support PackageSAP - Important Disclaimers