Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Report Application Server SDK

Hello All,

I am trying to develop web application using Report Application server SDK.

But my example report will not get open...

code as follows.

<%@ page contentType="text/html; charset=utf-8"%>

<%@ page import="java.net.URLEncoder" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.application.ReportClientDocument" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.data.ITable" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.data.Tables" %>

<%@ page import="com.crystaldecisions.sdk.occa.report.lib.ReportSDKException" %>

<%@ include file = "Utilities.jsp" %>

<%

/*

  • This page opens a report, extracts the names of all its tables, and then presents the

  • user with a selection list so that they can choose two tables. Following this

  • selection, ChooseLinking.jsp is loaded.

*/

%>

<%!

/*

  • Builds an HTML selection list containing the name of each table in the report.

  • The list permits multiple selections.

  • Parameters:

  • reportClientDocument

  • The ReportClientDocument object that will be inspected.

*

  • Returns: An HTML String containing the selection list.

*/

String createAvailableTablesMenu(ReportClientDocument reportClientDocument)

{

// Try to get the report's tables using its Database object.

Tables tables;

try

{

tables = reportClientDocument.getDatabaseController().getDatabase().getTables();

}

/*

  • If the tables cannot be read, or no tables are found, return a

  • descriptive HTML string.

*/

catch (ReportSDKException e)

{

return "<p>No tables available</p>";

}

if (tables.size() == 0)

{

return "<p>No tables available</p>";

}

// Create the HTML selection list.

String list = "<select name='SelectedTableNames' size='10' multiple>";

for (int i = 0; i < tables.size(); i++)

{

ITable table = tables.getTable(i);

list += "<option value='" + URLEncoder.encode(table.getAlias()) + "'>" +

table.getAlias() + "</option>";

}

list += "</select>";

return list;

}

%>

<%

/*

  • Try to open the report for this tutorial. If the open fails, redirect the user to an

  • error page. Note that CREATENEW_REPORT is string constant defined in Utilities.jsp

  • that identifies the report that is to be used with this tutorial.

*/

ReportClientDocument reportClientDocument = openReport("TargetReport_CreateNew", session);

if(reportClientDocument == null)

{

redirectWithError( "Error.jsp",

"The following report could not be opened:<i> " + CREATENEW_REPORT + "</i>",

response );

return;

}

%>

<html>

<head>

<link rel='stylesheet' type='text/css' name='stylelink' href='../tutss.css'>

</head>

<body>

<h4><%= session.getAttribute("TutorialName") %></h4>

<hr>

<form action='ChooseLinking.jsp' method='POST'>

<h5>Select two tables to add to the new report:</h5>

<%= createAvailableTablesMenu(reportClientDocument) %>

<p><input type="submit" class="button" value='Next'><p>

</form>

<hr>

</body>

</html>

Thanku...

Edited by: prashant joshi on Sep 30, 2008 2:49 PM

Not what you were looking for? View more on this topic or Ask a question