cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get more information about JavaScript API to server reports from a server to a client

Former Member
0 Kudos

Hi, we're trying to create a basic script to serve reports from a Crystal Report 2013 server to an instanceViewer inside a webpage.

I have followed the initial instructions inside the JavaScript API PDF, but I am not having any luck defining the instanceViewer.

Here's my code (mostly the same as in the PDF)

<!DOCTYPE html>

<html>

    <head>

        <title>Testing Crystal Reports</title>

  <!--<script src="hello.js"></script>-->

  <script src="http://192.168.5.27:8080/clientapi/CR/ViewerSeed.js" ></script>

  <script>

  var token = null;

  //var viewerInstance = SAP.CR.Viewer.getInstance("crystalViewer");

  function init()

  {

  token = "[token edited]";

  SAP.CR.Viewer.create("crystalViewer", 'viewerContainer1', onViewerInit, onViewerFailure);

  }

  function onViewerInit()

  {

  viewerInstance.setReportSource('17282', token);

  }

  function onViewerFailure(instance, error)

  {

  alert(error);

  }

</script>

</head>

<style>

.viewerStyle

{

position : absolute;

left : 12.5%;

top : 20.5%;

width : 75%;

height : 75%;

}

</style>

<body onload="init()">

<div id="viewerContainer1" class = "viewerStyle"></div>

</body>

As you can see there's nothing fancy, but I have no luck in getting past the: "SAP.CR.Viewer.Exceptions.ViewerInitException ['Failed to initialize viewer']" Error...

I've attached a screenshot

Accepted Solutions (0)

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

Since you're working with Crystal Reports Server, your best bet is going to be to use OpenDocument instead of trying to create a viewer inside your application.  OpenDocument is a URL you can send parameter information to and it will open the report in a viewer.  You can get information about how to use OpenDocument at http://help.sap.com/bobip - Go to the "Development Information" section.

-Dell

Former Member
0 Kudos

Thank You for your reply

I have a possibly related question. When I login to the BI Launchpad and go under preferences to get into the Web Intelligence area, I find that I have no such place. I'm not certain if that hampers me frm being able to serve up documents...

Thanks again for any help.