on 09-30-2014 12:00 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.