Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Page 1 of 10
Walk through a step-by-step example of how to enhance the new CRM WebClient UI. With SAP CRM 2006s and SAP CRM 2007, you do not need programming experience to customize your CRM WebClient UI screens.
Key Concept
The business role determines the functionalities a user can access. Within the business role, the config key determines the screens the user sees. SAP CRM 2006s and SAP CRM 2007 offer significant updates to the SAP CRM application. The main advantage for implementation specialists is that the new releases deliver an easy-to-use configuration workbench. This makes it possible for functional consultants with very little technical background to define the screen layouts without programming. In this article we share our experience in defining screen layouts in the new releases. In our example, our company sends different colors of golf balls for promotional purposes, so we want to record the favorite color of each contact person in SAP CRM. This is not a standard SAP field, so we need to add the field Favourite colour to the contact person overview page. To fulfill this requirement, we need to carry out the following steps: Step 1. Identify the component to enhance Step 2. Create the enhancement set Step 3. Enhance the component Step 4. Enhance the view Step 5. Enhance the context node Step 6. Add the field Step 7. View configuration Although this process applies to both SAP CRM 2006s and SAP CRM 2007, we are using SAP CRM 2006s for the steps in this example. In SAP CRM 2007, the process differs slightly. For example, in SAP CRM 2007 edit pages are usually displayed within the assignment block, whereas in SAP CRM 2006s they are not. Also, SAP CRM 2007 SP1 no longer requires display pages.
Technical Background
To fully understand all the steps and concepts described in this article, you need some technical background. Programming experience is not required, but you must be familiar with a few key concepts in programming. Two main concepts in the CRM WebClient UI you must know to fully understand and apply the concepts of this article are the business roles and config key. The most central concept within the CRM WebClient UI is the business role. It determines which functionalities are available for the user for example, marketing or sales manager functionality. Each business role contains a config key that determines which version of the screens the user can see. You can use this to differentiate between a sales manager and a sales assistant, for instance. Both need to be able to change customer data, but the sales assistant should see fewer fields or different reports. Both user types have different business roles linked to different config keys, so they see different versions of the same screen. In the CRM WebClient UI, these screens are called views and the different versions are called configurations. Were going to use an example view, the contact person overview page, to show how to create different configurations of this view and link them to the appropriate business roles.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 2 of 10
The main section of the page on the right side contains a collection of links to Account Management functionality. Here you find the Contact link under the Create heading in the right column. Click on this link to go to the contact person create page (Figure 1).
Note
In the traditional SAPGUI client, you can press F1 and then click on the technical information icon to learn more about a screen field, the current program, and the current screen. In the CRM WebClient UI, you must press F2 to learn more about the current field, component, and view. Next, go back to transaction BSP_WD_ CMPWB (Component Workbench). In the screen that appears, enter BP_CONT in the Component field and press Enter. The View field in Figure 2 informs you that you are in view ContactNewDetailsEF. Expand the Views and double-click on the BP_CONT/ContactNewDetailsEF view (Figure 3).
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 3 of 10
Note
CRM WebClient UI components use the Model-View-Controller (MVC) approach for creating Web applications. If you have experience with Web Dynpro development or Interaction Center in previous CRM releases, you will be familiar with it. Each component has a component controller that holds everything together and provides for interaction with other components. Views are the visible part of the component. A view has a layout that provides fields, buttons, and other visible elements, a controller that takes care of any interaction between the view and the user, and a model that holds the data. The screen in Figure 2 contains a field called Context Node that has the value BUILHEADER. If you look at Figure 3, you can see a line called Context just below the implementation class on the right side. Expand the line by clicking on the triangular icon just to the left and the system displays several new lines. The last one displays Context Node. Expand this line, too, and all context nodes of this view are displayed. Here you find the BUILHEADER context node. Before you can add the new field to the context node, you have to perform a few more steps.
of the Component field. Clicking on this icon displays a field called Enhancement Set to the right of the Component field. You need to define this enhancement set. All changes to components are done using this enhancement set and are separated in a layer. You can have more layers if you want, although only one can be active. To define the enhancement set, use transaction SM30. For the Table/View enter BSPWDV_EHSET_DEF. Click on the Maintain button and then on the New Entries button. In the screen that appears, enter the enhancement set definition and save (Figure 4).
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 4 of 10
Figure 5 Settings for the assignment of the Z_PROJECT enhancement set to client 140
Figure 6
The enhancement definition tells the runtime system to use the enhancement ZBP_CONT component instead of the standard BP_CONT component
The next screen shows you a list of enhanced components. If only one component exists in the list, you see the detail screen for that component, as shown in Figure 6. Otherwise mark the line with the BP_CONT component and double-click on Controller Substitutes on the left side.The screen that follows shows you a list of controllers that a custom controller has replaced. Besides the fact that the system uses this information to determine the correct controller at runtime, it is also a good way to get a complete view of all the parts of the CRM WebClient UI that have been enhanced with custom functionality.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 5 of 10
Figure 8
WD_CREATE_CONTEXT method of the custom view controller class automatically redefined when you enhance the view
This method now retrieves an instance of the enhanced context class (instead of the standard context class). Also, the system adds the ZTYPED_CONTEXT attribute to the class. This attribute is important because through it you can access all the modified and newly created context nodes from the view. In the attribute screen of the Class Builder, you can see that this attribute was added as a protected instance attribute and that it is typed as a reference to the enhanced context class (Figure 9). Notice that the TYPED_CONTEXT reference is still there. The unmodified parts of the view use it to gain access to the unmodified context and its nodes.
Figure 9
The system adds attribute ZTYPED_CONTEXT automatically when the view is enhanced
Once again the system has updated the system tables as a result of enhancing the view. Look at view cluster BSPWDVC_CMP_EXT again with transaction SM34. The system added an entry for the controller substitution telling the runtime framework to use the enhanced view controller instead of the standard one.
Note
In terms of classes inside a view, you always find an implementation class for the view, an implementation class for the context, and an implementation class for each context node. A context node contains the data and is usually based on a Business Object Layer (BOL) entity. This is a layer of objects such as an account, a contact person, or an order that the CRM WebClient UI uses to access the underlying data that is actually stored in the database. The context holds all individual context nodes together. It instantiates the individual nodes and links them together when you have a dependency between two context nodes. The view instantiates the context.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 6 of 10
pops up. Look for a success message at the end, ignoring any other messages given there. Again, leave the Workbench and go back to the context node you are enhancing just to be certain that the display is correct. The context node class is now a custom class starting with a Z. In the main overview screen of the BP_CONT component, click on ContactNewDetailsEF.htm under View Layout and click on the Properties tab. Here, the Controller Class has changed to the new custom controller class ZL_BP_CONT_ CONTACTNEWDETA_IMPL. Next, click on the Page Attributes tab (Figure 10). The BuilHeader attribute, which refers to the context node, now contains the custom controller class in the Associated Type field.
Figure 10
Page attributes of the HTML page belonging to the view correspond to the list of context nodes
Go back to the main overview screen of the BP_CONT component and double-click on the custom implementation class of the context node ZL_BP_CONT_CONTACTNEWDETA_CTXT. This opens the Class Builder. In the Methods tab, notice that the CREATE_BUILHEADER method, which instantiates the BUILHEADER context node, has been redefined (Figure 11). The system has created this custom class starting with a Z as a subclass of the standard class when the context node was enhanced. Instead of the standard context node class, the enhanced custom class is used for the context node.
Figure 11
The system redefined the CREATE_BUILHEADER method when the BUILHEADER context node was enhanced
Note
Earlier we pointed out the changes made as a result of enhancing the view. We showed the redefined method WD_CREATE_CONTEXT, but there was another redefined method called SET_MODEL. This method is responsible for making the context node data available to the Business Server Page (BSP) that is displayed to the user. Initially this method just calls the super method, which is the method of the original class. If you create a new context node (instead of enhancing an existing one as we are doing now), this method is extended to set the corresponding new page attribute referring to the new custom context node class.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 7 of 10
This BOL entity is based on the Data Dictionary structure CRMST_HEADER_OBJECT_BUIL. When the new field is added to this structure, the BOL entity BuilHeader also has this new field as an attribute. The BUILHEADER context node is based on the BuilHeader BOL entity, so it also has this new attribute.
Note
When you want to enhance a structure for a BOL entity, it may be better to use the Easy Enhancement Workbench (EEW) instead of manually extending existing Data Dictionary structures. If the EEW supports the corresponding business object, it is a consistent method of extending it. If you were to add a field to the CRM WebClient UI that should also be replicated to SAP ERP, or if it should be made available for SAP NetWeaver BI reports, then its better to use the EEW. All relevant structures are extended this way. For this example, we are adding the new field in an append structure of the CI_EEW_BUT000 structure. Note that this is a shortcut to keep the focus on the real topic of this article. EEW also uses this structure. Use transaction SE11 to create an append structure. Do the same for structure CI_EEW_BUT000_X, which the system uses to identify changed fields. The new field that we add to the append structure of the CI_EEW_BUT000 structure is called ZZFAVCOLOUR and has the data element ZCOLOUR. The ZCOLOUR data element has domain ZDCOLOUR, which is defined as a numeric type with one position. The domain has three possible values: Red, Yellow, or Blue (Figure 13). Perform these elementary Data Dictionary changes with transaction SE11. Do not forget to add the ZZFAVCOLOUR field to the append structure of the CI_EEW_BUT000_X structure. This is just an update indicator with component type BAPIUPDATE.
Figure 13
Create the domain ZDCOLOUR and add colors in the Value Range tab as possible values for the new ZZFAVCOLOUR field
Tip!
You can also add the value help table via the design layer if you are familiar working with it. This approach does not require any custom classes on the CRM WebClientUI layer itself. After making these Data Dictionary changes, go back to the Component Workbench. Call up the BP_CONT component and navigate to the enhanced BUILHEADER context node of the BP_CONT/ContactNewDetailsEF view. Expand the BUILHEADER context node attributes to see the attribute STRUCT.ZZFAVCOLOUR in the list.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 8 of 10
Expand the BUILHEADER node and look for the new field Favourite Colour. Often it is easier to click on Show Technical Details to identify the field you need. The context nodes that are based on standard structures can contain a lot of fields and have similar or identical descriptions, so a mistake is easily made if you simply identify a field based on its description. Select //BUILHEADER/STRUCT.ZZFAVCOLOUR and click on the Language field. Then click on the add icon to add the field below the Language field. To set a label for the field, Alt-click on it. The field properties are now displayed on the right side of the screen, where you can set the label text and other layout properties of the field (Figure 15).
Figure 16The Favourite colour field appears with the drop- down menu options
Enter some test values in the General Data block and pick a color. Click on the Back button and then on the Save button in the next page that displays an overview of the contact data. To verify that your color is saved, check table BUT000 with transaction SE16.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 9 of 10
Figure 17
The Favourite colour field now also appears for existing contacts, but it is not rendered correctly
The field is there, but this is not how you want it to be. This is a display view but the system has rendered the field the same way as it did in the create page. We are going to solve this issue by adding a new field to the BUILHEADER node. This time we are not updating any underlying structures like we did in the previous steps. Instead, we add the field to this context only and write a GET method that retrieves the color text based on the favorite color value.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011
Page 10 of 10
Change Details
Finally, press F2 to access the ContactDetailsEF view to add the new field here. Go to the component workbench and enter component BP_CONT and enhancement set Z_PROJECT. Look up the ContactDetailsEF view and double-click on it. Click on the Configuration tab to call up the default configuration. Add the STRUCT.ZZFAVCOLOUR field of the BUILHEADER context node as you did in the first view. No coding is necessary here. Boris Dingenouts is a senior SAP CRM consultant for the Dutch consultancy company Protg Consultancy. Boris has more than 12 years of consulting experience in SAP, with more than seven years in SAP CRM. Protg Consultancy is an SAP consultancy company focused on SAP CRM. You may contact Boris via email at boris.dingenouts@protegeconsultancy.nl. Manuel Dekker is a senior SAP CRM consultant and founder of the Dutch consulting company Omnidev. He has 12 years of SAP consulting experience, of which the last seven years has been with SAP CRM. His main focus is the design and implementation of custom solutions. You may contact Manuel via email at manuel@omnidev.nl.
http://www.crmexpertonline.com/article_printable.cfm?id=3547
03-01-2011