Skip to Content

Tool tips showing at glance information of a particular object is one quick and easy time-saver that you can use in a web application. Ever wondered just hovering mouse on a link in your CRM UI will show the entire relationship linkage of an Account in the tool tip. This blog is about my experiences of building a content rich tool tip using jQuery in CRM UI.   Web based CRM applications such as salesforce.com provide fancy tool tips. When you hover on link for “Leads” on the Account Overview page, the tool tip shows the leads for this account in a fancy table and can be further navigated.   We had a similar request from our user community to build a fancy tool tip to show the entire Relationship Linkage of an Account on hovering over the link in Account Overview page in SAP CRM UI.   The only way I could think of building this feature was by using ready to use jQuery plugins in a BSP page. I started looking for jQuery plugins available for building fancy tool tips and found out this link which has 30 different plugins available. Out of all them clueTip seemed to fancy and simple to implement. Here are some links for further information:  

Here is how the tool tip looks on the Accounts Overview page:    

http://www.divulgesap.com/media/userfiles/flash/CRM_UI_Hover_Tooltip.swf

CRM UI Configuration

We are going to create a new empty view in the Accounts Overview page to display two links. When you hover on these links this tool tip is triggered. Here are the basic CRM UI configuration steps performed:

  1. Enhance the component BP_HEAD from transaction BSP_WD_CMPWB with your Enhancement set.
  2. Create a new empty view, say ZHOVER.
  3. In the Runtime Repository Editor add this new empty view ZHOVER to the ViewSet BP_HEAD/BPHEADOverview under the ViewArea OverviewPage.
  4. Now configure your viewset BP_HEAD/BPHEADOverview to display the empty view ZHOVER on the top Assignment block.

Here is the screen shot of my Viewset assignment block configuration:

We are done with the UI configuration now. When this empty view is created, the system creates a new BSP application ZBP_HEAD with a view ZHOVER.htm and a controller ZHOVER.do.

Now you can work on this BSP application from SE80.

First step is download jQuery and clueTip plugins from the links mentioned before. Include the following JS and CSS files required for displaying the tool tip into the MIME Repository of the BSP application.

  • jquery-1.4.2_min.js
  • jquery.cluetip.css
  • jquery.cluetip.js
  • jquery.hoverIntent.js (not mandatory)

Here is how your BSP application will look:

Another better approach is to add these files in MIME repository under path /SAP/PUBLIC/<FOLDER>. This way you can reuse these files in any BSP application.

Now, in the ZHOVER.do controller class add a new method called GET_SELECTED_PARTNER. This method is used to retrieve the BP number displayed in the overview page. This method will have an exporting parameter EV_PARTNER TYPE BU_PARTNER. This method will be called from the view and BP number will be passed to the JS. Here is the code for this method:

Now, let’s see the layout of the view “ZHOVER.htm”. This page will have two links “Relationship Linkage” and “Attachments”. When you mouse-over on “Relationship Linkage” link the content of the page “detail.htm” is shown as tooltip. In the same way the content of page “attachments.htm” is shown as tooltip for “Attachments” link.

I have used HTMLB tree to display relationship linkage of an account in detail.htm page. My detail.htm page has an auto page attribute “param1” which is the BP number. The BP number is passed to this page as a URL parameter from ZHOVER.htm page. In the same the way attachments.htm page is developed using HTMLB tags. I have not included the coding for these pages. You can develop your our own detail.htm page.

Here is complete coding for ZHOVER.htm page:

<%@page language="ABAP" %>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="crm_bsp_ic" prefix="crmic" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<link href="/sap/bc/bsp/sap/zbp_head/jquery.cluetip.css" rel="stylesheet" type="text/css" />
<link id="urstyle" href="/sap/public/bc/ur/Design2002/themes/sap_tradeshow/ur/ur_nn7.css?6.0.17.0.0" type="text/css" rel="stylesheet">
</link>
<script src="/sap/bc/bsp/sap/zbp_head/jquery-1.4.2_min.js" type="text/javascript"></script>
<script src="/sap/bc/bsp/sap/zbp_head/jquery.hoverIntent.js" type="text/javascript"></script>
<script src="/sap/bc/bsp/sap/zbp_head/jquery.cluetip.js" type="text/javascript"></script>
<script src="/sap/public/bc/ur/Design2002/js/sapUrMapi_nn7.js?6.0.17.0.0" language="JavaScript" type="text/javascript"></script>
<script src="/sap/public/bc/ur/Design2002/js/popup_nn7.js?6.0.17.0.0" language="JavaScript" type="text/javascript"></script>
<script src="/sap/bc/bsp/sap/zbp_head/custom_scripts.js" type="text/javascript"></script>
<script type="text/javascript">
var $j=jQuery.noConflict();
 function LoadMyJs(myElement){
     $j(myElement).cluetip({
     cluetipClass: 'jtip',
     width: 450,
     arrows: true,
     attribute: 'rel',
     dropShadow: false,
     hoverIntent: false,
     sticky: true,
     mouseOutClose: true,
     closePosition: 'title',
     showTitle:false,
     topOffset:85
     });
     }
function populateIframe(id,path)
{
    var ifrm = document.getElementById(id);
    ifrm.src = "/sap/bc/bsp/sap/zbp_head/data.htm?file_id="+path;
}
</script>
<%
  data lv_partner type bu_partner.
  lv_partner = controller->GET_SELECTED_PARTNER( ).
%>
<a id="detail-link"
   href="#"
   rel="/sap/bc/bsp/sap/zbp_head/detail.htm?param1=<%= lv_partner %>"
   onmouseover="LoadMyJs(this)" >
<%-- LoadMyJs(this) --%>
<b>Relationship Linkage</b>
</a>
 &nbsp&nbsp&nbsp
<a id="att-link"
   href="#"
   rel="/sap/bc/bsp/sap/zbp_head/attachments.htm?partner=<%= lv_partner %>"
   onmouseover="LoadMyJs(this)" >
 <b>Attachments</b>
</a>

Some notes on this page:

  1. Include all the scripts and styles with their full path as this page is going to be a fragment inside the overview page and the absolute path can’t be accessible at that level. For example instead of using href=”jquery.cluetip.css” simply use full path href=”/sap/bc/bsp/sap/zbp_head/jquery.cluetip.css”.
  2. The way the clueTip creates the tooltip is, it just creates a “<div>” element in the Overview page with the detail.htm page content using jQuery Ajax calls. Also, as mentioned earlier, I had used htmlb:Tree tag in detail.htm page to display the Relationship view in a tree. As our “Overview” page is built with CRM UI specific tags such as thtmlb, tajax etc., it can’t render a htmlb:Tree. So we need to include the JS and CSS required for htmlb in “head” tag part of “hover” page. If some one has a better idea than including the JS and CSS files for HTMLB, please write them in the comments section of this blog.
  3. LoadMyJS() function calls the clueTip plugin to create tooltip. There are various options for clueTip which can be found in the link above. As you can observe anchor tags in this page have the required URL in “rel” attribute and the same is passed in options part of clueTip.
  4. For sticky tooltip I have used options sticky: true and mouseoutclose: true in the clueTip plugin.
  5. In order to avoid jQuery JS library to conflict with other HTMLB JS libraries, make sure jQuery.noConflict() is called.

Another approach is to create a nice BSP extension using clueTip and jQuery. Use this BSP extension where ever you need to generate this kind of tooltip.

Last but not the least, I would like to thank my lead Gautam Mandal who had given me the base idea for building this.

I hope this blog will help SAP CRM UI developers to develop nice content rich tool tips in SAP CRM at par with other browser based CRM applications.

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Christian Stemmer
    Hi,

    JQuery offers very interesting possibilities.
    I recently implemented the autocomplete function of jquery. Unfortunately, the menu navigation (f. eks. Master data) in CRM does not work anymore when i include jquery-1.6.2.js in my code. Did you experience the same?

    (0) 
    1. Ravikiran Chittum Post author
      Hi Chris,

      Yes, you are right once you include jquery js file, other CRM UI navigation don’t work. You need to use jQuery.noConflict() function to handle any conflicts  with other libraries for example thtmlb scripts. Refer to the url for more info:
      http://docs.jquery.com/Using_jQuery_with_Other_Libraries

      I used this in CRM 2007 SP9 in IE8 and it works.

      Thanks for reminding this. I had totally forgotten about this.

      Hope this answers your question.

      Ravi

      (0) 
    1. Ravi Kumar

      Hi Mahesh,

      I have followed all steps as specified in the above document,but when ever am moving the cursor on the link it is throwing the below error.

      Webpage error details

      User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)

      Timestamp: Mon, 29 Jul 2013 09:16:46 UTC

      Message: Object expected

      Line: 18

      Char: 1

      Code: 0

      URI: http://XXXXXXXXXXXXXXXXXXXXXXsap(ZT1Va0ZXU1Y5ZlgxOWZYMTlmTWw5Zk1qTXhkQ2ZxRFdvN0h0Sy1oZjBfUkRCd1B3PT0=)/bc/bsp/sap/crm_ui_frame/BSPWDApplication.do?sap-client=001&sap-language=EN&sap-domainrelax=min&sap-domainrelax=min

      Let me know how to solve the issue.

      Thanks and Regards.

      Ravi Kumar .Y

      (0) 

Leave a Reply