Blogs

Ted Ueda

Integrate Google Maps using the Web Intelligence Interactive Viewing Extension Points API
Ted Ueda SAP Employee Active Contributor Silver: 500-1,499 points
Business Card
Company: SAP
Posted on Aug. 07, 2009 08:25 AM in Enterprise Data Warehousing/Business Warehouse, Business Intelligence (BusinessObjects), Java Programming, JavaScript, SAP BusinessObjects Web Intelligence

Subscribe.Subscribe
Print. Print
Permalink Permalink
Share

Update: added sample codes for .NET InfoView as well as for Java InfoView.  

Introduction

BusinessObjects Enterprise XI 3.1 Service Pack 2 introduces new APIs that a developer may use to extend the usability of Web Intelligence.  Last time, I blogged about the Web Intelligence Calculation Extension Points, an API for creating new custom functions for use in Web Intelligence documents.

In this blog, I'll briefly describe the Web Intelligence Interactive Viewing Extension and Integration Points API.  This link will direct you to a download page, where you can obtain documentation and samples for this API, as well as for the Web Intelligence Java Reporting Panel (JRP) and Rich Client (WRC) Extension Points. 

I previously wrote about the JRC+WRC Extension Points in my blog Integrate Google Maps with the Web Intelligence Rich Client.  Where that extension allows for enhancements to the Java-based JRP and WRC UI, the Interactive Viewing extension allows for enhancements to the DHTML-based Interactive Viewer. 

Both extensions are Innovation Center prototype geared towards OEM/Partner customers for integrating and extending the Web Intelligence Viewers and Editors.  Although full support is provided only for OEM/Partners, the APIs are available without any additional downloads, and the download link for the docs contain an Evaluation License to allow other developers to "check out" the functionality.

The Interactive Viewing extensions consist of JavaScript and HTML code run client-side to add to the viewer UI, and Java or .NET code run server-side to access the ReportEngine SDK (Java or .NET) used in the processing of the document for viewing and editing.  Access to ReportEngine - with its report creation/modification capabilities - means much of the features available in the Interactive Viewer and Editor are accessible through this API.

With this extension, you can programmatically access the structure of the Web Intelligence document being viewed - its  tables, charts, data providers, and even its internal data sets. You can programmatically remove components of the viewer you don't prefer to expose to clients, and add your own - toolbar buttons and "Left Panel" tabbed panes.  You can even integrate components of the viewer into your own custom web application.

Let's walk through a simple code example that uses this extension - I'll integrate Google Maps into the Interactive Viewer.

Integrating Google Maps - A Walkthrough

Here's a screenshot of the results:

image

When you click on the "G" button in the toolbar, a JavaScript callback function invokes a JSP page, that invokes ReportEngine to introspect the Data Provider of the Web Intelligence document.  It seeks out columns named "City" and "State", then dynamically creates JavaScript for creation of a Combo Box selection control in a pop-up dialog box.  The Combo Box is filled with all the City+State values and selection of a value posts back to a JSP page that invokes JavaScript using the Google Maps API to display the location of the selected City + State.

Installation of XI 3.1 Service Pack 2

To use the Interactive Viewer extensions, you must have BusinessObjects Enterprise XI 3.1, and you must install Service Pack 2 on top of it.

Modification of the webiviewer.properties file

In the Java Web Application AnalyticalReporting, open the file AnalyticalReporting/WEB-INF/classes/webiviewer.properties file, and set the "ALLOW_CUSTOMIZATION" property to equal "yes".  This enables the DHTML extensions.

Modification of the user.js file

An Extension Point customization is declared and triggered by addition of JavaScript code to the file AnalyticalReporting/viewers/cdz_adv/user.js.  Here is the user.js file I use:

user.js

This file specifies that this extends the Toolbar ("MENUBAR") by addition of a button, where the button image may be found at AnalyticalReporting/viewers/cdz_adv/customize/samples/Menu_Bar/google_maps_icon.png (I just downloaded Google's icon, trimmed and resized to fit on the toolbar).  Clicking on the button pops up a "popupWindow" of size 600x400, where the pop-up window calls back to the JSP page AnalyticalReporting/viewers/cdz_adv/customize/samples/Menu_Bar/googleMaps.jsp.  The Interactive Viewer context - including such info ass the ReportEngine document  storage token - is configured to be appended to the postback to googleMaps.jsp as HTTP GET parameters.

Create the postback Java Server Page

I made just a few modifications to the Yahoo! Financial sample code found in the documentation+sample download linked above to create this JSP page. The googleMaps.jsp page is given here (please Select All Ctrl-A then Copy Ctrl-C, and then Paste Ctrl-V to a text editor, for ease of reading).

googleMaps.jsp

This page retrieves the document storage token from the HTTP Request, then retrieves the Web Intelligence document being displayed in the viewer via the ReportEngine.  It then introspects the Data Provider for City+State data, and generates HTML with JavaScript that creates a Combo Box with the location data.

The JavaScript function comboCB then calls back to the JSP page AnalyticalReporting/viewers/cdz_adv/customize/samples/Menu_Bar/maps.jsp with the location appended as a HTTP Get parameter whenever a selection is made.

Create the Google Maps API page

The maps.jsp contains the Google Maps API JavaScript code:

maps.jsp

This merely retrieves the location information from the HTTP Request, then triggers a JavaScript client-side that invokes Google Maps, geolocates the position, then centers the map around that position.  Note that the "key" code in this page is tied to my domain - you'll have to go to the Google Maps API site, and generate a key for your own domain.

Create a Web Intelligence document with City and State columns in the Query

Now, create a Web Intelligence document off of the eFashion Universe, where you include the Store City and Store State objects in the Query.  Restart your Java Web Application Server, flush cache on your web browser (to ensure you're retrieving the modified JavaScript files), log onto Java InfoView, ensure you've configured your User Preferences for the Interactive Viewer and Editor, and navigate to the Web Intelligence doc you've just created. 

.NET InfoView Samples Codes

Here I'll present equivalent sample code files for .NET InfoView. First, you enable the Interactive Viewer Extension Point by editing the file:

    <Enterprise INSTALL>\Web Content\InfoViewApp\AnalyticalReporting\Web.config

and setting WebiSettings ALLOW_CUSTOMIZATION to "yes".

The JavaScript file

    <Enterprise INSTALL>\Web Content\InfoViewApp\AnalyticalReporting\Viewer\customize\user.js

is modified to point to the ASPX files deployed to the folder

    <Enterprise INSTALL>\Web Content\InfoViewApp\AnalyticalReporting\Viewer\customize/samples/Menu_Bar/

where the files are:

user.js

 

googleMaps.aspx

 

maps.aspx
Summary

With a couple of pages of code, I was able to create a very simple Proof-of-Concept that integrates Google Maps into the Interative Viewer.  There's certainly room for improvements, of course!  I'll leave that up to you...

Next time, I'll blog about the Web Intelligence Custom Data Provider Plugins, another very exciting API new with Service Pack 2.

 

Ted Ueda  Active Contributor Silver: 500-1,499 points is a Senior Support Engineer with SAP


Comment on this articleAny feedback? Post here!
Comment on this weblog
Showing messages 1 through 12 of 12.

Titles Only Main Topics Oldest First

  • Google Maps and Webi
    2010-01-04 13:44:57 Prem Udayan Business Card [Reply]

    Hi Ted,
    I did all the steps you mentioned in your blog regarding webi and google maps integration. I generated a new key from google apis site for my domain (which is mentioned as http://bo31:8080) where bo31 is the server where bo31 SP2 is installed. I created a report with city and state columns in it and when I click on the new button on the menu bar a pop up window opens up and HTTP 404 page not found error.


    Am I missing something here. Any help on this is greatly appreciated.


    Thanks,
    -Narayan

    • Google Maps and Webi
      2010-01-04 13:56:08 Ted Ueda SAP Employee Business Card [Reply]

      So what URL request is returning the 404?


      Ted

      • Google Maps and Webi
        2010-03-24 14:54:48 Elangovan Rajamohan Business Card [Reply]

        Hi Ted,
        I have a scenario which I think needs to use WEBI Extension points. I hope you can help with my problem.


        My requirement is: in a WEBI XI report get the zipcodes from a user parameter and pass it to a webiservice and get the latitude and longitude. Use the latitude and longitude values int the report query's where clause.


        Environment: WEBI XI R3


        Kindly give your ideas and thoughts on how to do this.


        THANKS,
        Elango


Showing messages 1 through 12 of 12.