cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to obtain binary data using URL REPORTING?

Former Member
0 Kudos

Currently we are using CR4E API to execute and render crystal reports through Java App server. It consumes more memory and makes our application performance problem while executing scheduled reports. So we are planning to off load the crystal report execution and rendering from java app server and move Crystal Reports Server 2011.

Currently our application supports both on demand and scheduled reports and also supporting different types of output Html View, PDF View, PDF File, PDF Attachment, Sending to printer and Email Sending.

Our current code logic is once we get Binary Stream we will support all the above output types.

To migrate Crystal Reports Server 2011, we are planning to use u201CViewing Crystal Reports Using URL

Reportingu201D approach.

http://<servername>:<port>/CrystalReports/viewrpt.cwr?<command1>&<command2>&...&<commandN>;

Is it possible to get Binary Data with URL Reporting approach?

I can support surely Html View and PDF View types for on demand report with URL Reporting approach. But my doubt is how to get binary stream to create PDF file and attachment with URL Reporting approach.

Is it possible to achieve my above current support with URL Reporting approach?

Please help me on this to go with this approach.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

aasavaribhave
Advisor
Advisor
0 Kudos

URL reporting supports only viewing in native or a few 3rd party formats, it doesn't give you the byte stream. To be able to get the RPT bytestream you need to use Repport Application Server ( SDK) SDK, the API calls to get the ByteStream are same as CRJ, printOutputController().export() with one change that the bytestream is created at RAS and not APP server.

Former Member
0 Kudos

Hi Aasavari Bhave,

We are planning to purchase Crystal Reports Server 2011, is it possible to access Crystal Reports Server through Report Application Server (SDK) SDK. It seems there are two servers available in BusinessObjects Enterprises Environment, Report Application Server and Crystal Reports Processing Server.

To use RAS SDK what server licence we have to purchase?

aasavaribhave
Advisor
Advisor
0 Kudos

If you have Crystal Reports Server 2011 you can use RAS SDK to access reports published to CR Server. You need any server level product e.g. CR Server, Edge or BI 4.0 to be ab;le to use RAS. No other special license is required. Crystal Report Processing Server is also used for report viewing but it does not give byte stream. You can view the report with dhtml viewer or in a 3rd party format using processing server. In general processing server is preferred over RAS for viewing as it gives better performance but processing server doesn't give out byte stream. RAS is meant for runtime report modification but also used for exporting report to 3rd party using byte stream. Here are Developer library and API ref starting page.

http://www.sdn.sap.com/irj/boc/sdklibrary

Former Member
0 Kudos

Hi Aasavari Bhave,

I have explored the URL Reporting Documentation and seen u201Ccmd and EXPORT_FMTu201D options. What is the use of Export PDF options mentioned in URL below?

http://<servername>:<port>/BOE/CrystalReports/viewrpt.cwr?id=1152&cmd=EXPORT&EXPORT_FMT=U2FPDF:0

Is it possible to get byte array with below approach?

try{

String queryURL = u201Chttp://<servername>:<port>/BOE/CrystalReports/viewrpt.cwr?id=1152&cmd=EXPORT&EXPORT_FMT=U2FPDF:0u201D;

HttpClient client = new HttpClient();

GetMethod get = new GetMethod(queryURL);

int statusCode = client.executeMethod(get);

if (statusCode != HttpStatus.SC_OK)

{

System.err.println("Method failed: " + get.getStatusLine());

}

byte[] responseBody = get.getResponseBody();

} catch (Exception ex){

System.out.println("Exception while querying " + ex.getLocalizedMessage());

}

Please suggest me, is possible to get Byte array with URL Reporting approach if not what is the best approach to support above requirement.

RAS SDK or Web Service Consumer API ?

aasavaribhave
Advisor
Advisor
0 Kudos

this may or may not work. however if httpclient creates a pdf that is somehow unreadable in adobe, SAP will not support it. As long as viewrpt.cwr launches the report properly it will be considered as working per expectations. Also you need to pass the token or logon credentials to the URL for it to work w/o prompting.

Former Member
0 Kudos

Thanks for your reply!

If URL Reporting is not recommended to get Byte Stream means then what is the right approach to get Byte Stream?

RAS SDK or Web Service Consumer API?

aasavaribhave
Advisor
Advisor
0 Kudos

RAS is preferred over web services, since web services is slower and a lot of stuff is deprecated in BI 4.0\ CRS 2011 for web services.

Former Member
0 Kudos

Hi Aasavari Bhave,

I have two doubts.

Qus 1:

http://<servername>:<port>/BOE/CrystalReports/viewrpt.cwr?id=1783

To use URL Reporting, do we need crystal report viewer component on client machine?

Because I am able access this URL reporting on only SAP Business Objects installed machine. So if I want to access this same URL reporting in some other machine what I have to do? How can I install crystal report viewer component alone in client machine?

Qus 2:

I am currently using CR4E API, so I have some set of crystal reports jars already in my development environment. Now I want to use RAS SDK to access Crystal Reports Server 2011, what all are required jars for RAS I need to include in my development environment?

I am seeing to many jars on SAP Business Objects Installed environment. So could you please help me to select required jars for RAS SDK and from where?

Thanks

aasavaribhave
Advisor
Advisor
0 Kudos

You do not need SAP Business Objects or Crystal Components to be able to launch openDocument URL. As long as the client machine and srever where /OpenDocumen to /CrystalReports is deploy it should work. because it uses 0 client viewer, no installation is required. If you use active X or java viewer it will prompt for active x or java component download as only those 2 viewers require some components on crystal. I hope that clarifies.

To use RAS 2011 instead of CR4E, first remove all CRJ jar's from your application classpath. Here is Enterprise SDK [Developer Guide|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_boejava_dg_en.zip] Then navigate through: Setting up the development environment > Web application setup > JAR files needed for deployment of SAP BusinessObjects software

It lists the required SDK and external Jars that are required. You need to include Platform, RAS and Viewers ( for viewing reports) SDK.

Former Member
0 Kudos

Hi Bhave,

Thanks lot for helping me on this crystal reports server integration

I have two clarifications.

1. I need to keep the existing CR4E API implementation also in my application so that existing customer still they can use crystal report without crystal reports server.

Crystal reports server integration we are going to give new feature so that new customer can use crystal report server. For this server integration we are going to use RAS SDK.

So I am going to use both CR4E API and RAS SDK. Is that create any conflict or problem?

How do ensure which API is running while accessing crystal reports server, because looks like both are using same classes.

2. I am doing one POC with RAS SDK to access crystal report server. I have one report published on CMS which is contains sub report without parameter linking between main and sub report.

I am not able to pass parameter to sub report using RAS SDK. Can you please give me piece of code how to pass parameters into sub report?

Parameter linking between main and sub report working fine.

aasavaribhave
Advisor
Advisor
0 Kudos

1. I would recommend keeping CRJ and RAS application different, that would cause conflict. The CRS 2011 has updated version of APIs, some additional exporting format which CRJ doesn't have, so mixing them may caus an issue and will not be supported. So you need to have 2 separate applications 1 for CR4J and other for RAS.

2. to set subreport parameters use:

reportClientDoc.getParameterFieldController().setCurrentValue("<subreportName>", "StringParam", new String("Subreport string value."));

Former Member
0 Kudos

Hi Bhave,

thanks for your reply!

i am facing below problem can you please help me on this.

1. I can able to supply Runtime Data Source (ResultSet) for main report but not able set ResultSet for sub report through RAS. Can you give me piece of code how to set ResultSet into sub report?

2. If we set ResultSet for both main and sub report, then how parameter linking between main and sub report will work?

3. I am also trying to use Web Service Consumer API but I am getting compilation error like Unhandled exception type DSWSException. I can able to get BIPlatForm service but while trying to get Report Engine service getting compilation error my sample code is below.

Try{

String reportName = "SampleCrystalServerReport";

String WS_URL_Base = "http://XXXX280:8080/dswsbobje/services/";

String WS_URL_Session = WS_URL_Base + "session";

String WS_URL_ReportEngine = WS_URL_Base + "reportengine";

String WS_URL_BIPlatFrom = WS_URL_Base + "biplatform";

String username = "administrator";

String password = "XXXX@123";

Session oSession=null;

Connection oConnection=null;

oConnection = new Connection(new URL(WS_URL_Session));

EnterpriseCredential oEnterpriseCredential = EnterpriseCredential.Factory.newInstance();

oEnterpriseCredential.setLogin(username);

oEnterpriseCredential.setPassword(password);

oSession = new Session(oConnection);

SessionInfo objSessionInfo = oSession.login(oEnterpriseCredential);

oConnection.setURL(new URL(WS_URL_BIPlatFrom));

BIPlatform oPlatform = new BIPlatform(oConnection,oSession.getConnectionState());

oConnection.setURL(new URL(WS_URL_ReportEngine));

ReportEngine oReportEngine = new ReportEngine(oConnection, oSession.getConnectionState());

ResponseHolder rh;

//set the getOptions for retrieval of the Users folder

GetOptions oGetOptions= GetOptions.Factory.newInstance();

oGetOptions.setIncludeSecurity(Boolean.FALSE);

//get the report

rh = oPlatform.get("path://InfoObjects/Root Folder/Report Samples/Selva Sample Reports/" + reportName,oGetOptions);

//get report id

String repID = rh.getInfoObjects().getInfoObjectArray(0).getCUID();

System.out.print("Report CUID *****************************************************:"+repID);

}catch(AxisFault af)

{

com.businessobjects.dsws.DSWSException d = Consumer.GetAxisFaultDetails(af);

if (d!=null)

{

//useDSWSExceptions

String afString = "exception caught<br>";

afString += d.getCauseID();

afString += ".<br>";

afString += d.getCauseException();

afString += ".<br>";

out.println(afString);

}

else

{

System.out.println(af.toString());

}

}

Regards,

Selva

aasavaribhave
Advisor
Advisor
0 Kudos

In BI 4.0 onwards ReportEngine class is obsolete. You no longer use ReportEngine but use BIPlatform where its functionality is supposed to be integrated. Check [Developer Guide for Web services in 4.0|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_wssdk_dg_en.zip] for all other deprecation.

For passing resultset check this [Sample|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/90595022-2057-2c10-66a2-b26fc0d9de5c&overridelayout=true]

It doesn't show the subreport ones, but all you have to do is get the SubreportController Object and call:

subreportController.getDatabaseController().setDataSource(results,

rcd.getDatabase().getTables().getTable(0).getName(),

"Reports");

For parameter linking I am not sure if there are any changes. If you encounter any bugs you can log a ticket with SAP support.

Former Member
0 Kudos

Hi Bhave,

Really thanks for your Really helpful answer!

I want to open an unmanaged report from network path through RAS. I can able to open and also able to set ResultSet dynamically. But one scenario I need to set JNDI Data Source or Connection URL to the ReportClientDcoument for Oracle and MSSQL database.

I find some sample code to set ODBC DSN name but I cant use DSN name so can you please give me piece of code to set JNDI Data Source or Connection URL to the ReportClientDcoument for Oracle and MSSQL database.

aasavaribhave
Advisor
Advisor
0 Kudos

these are CRJ samples but the APIs are really the same, similar thing should work in unmanaged RAS:

[Oracle JNDI|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/f02a20ac-3f11-2c10-4ab3-c32cd5cb778a]

[General, i think this covers SQL server|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/c07fec3e-3e11-2c10-1991-8c0fb0b82b75]

aasavaribhave
Advisor
Advisor
0 Kudos

Did you check this [Sample|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/90595022-2057-2c10-66a2-b26fc0d9de5c&overridelayout=true]?

Former Member
0 Kudos

Hi Bhave,

Recently My company had upgraded to new CR Server, Previously I was able to get the report byte Stream using URL http://xyz:8080/businessobjects/enterprise11/admin/en/viewrpt.cwr?id=12892&apsuser=ABC&apspassword=A...,  Now CR Team asked to use different URL http://abc:8080/BOE/CrystalReports/viewrpt.cwr?id=12625&promptOnRefresh=1&apsuser=ABC&apspassword=AB...

The ResponseBody I am getting If I point to new CRS is below

<html><head>

</head><body>

<form action="../OpenDocument/1206232101/CrystalReports/viewrpt.cwr" method="get">

<input type="hidden" name="apspassword" value="ABC1234" >

<input type="hidden" name="id" value="12625" >

<input type="hidden" name="cmd" value="EXPORT" >

<input type="hidden" name="apsuser" value="ABC" >

<input type="hidden" name="connect" value="1" >

<input type="hidden" name="apsauthtype" value="secEnterprise" >

<input type="hidden" name="prompt1" value="1850" >

<input type="hidden" name="prompt0" value="816" >

<input type="hidden" name="EXPORT_FMT" value="U2FPDF:0" >

<input type="hidden" name="promptOnRefresh" value="1" >

</form>

<script type="text/javascript">document.forms[0].submit();</script>

</body>

</html>

Is there anyway I can get the Byte Stream ?

Code Below shows the JAVA Code

    byte[] responseBody = null;

    try {
        // Execute the method.
        int statusCode = client.executeMethod(method);
      

        if (statusCode != HttpStatus.SC_OK) {
            // The report server is down. throw error.
            throw new UrlAccessException("The server with url " + pdfUrl +  " is down.");
        }

        // Read the response body.
        responseBody = method.getResponseBody();      
       

Thanks in Advance

aasavaribhave
Advisor
Advisor
0 Kudos

try this:

byte[] b = IOUtils.toByteArray(new URL("<your url>").openStream());

I don't know if it works, but worth a try.

and here are commons IO librares you need for IOUtils.

http://commons.apache.org/io/download_io.cgi

Answers (0)