Advanced Crystal Reports Handling
Using the REST API to Retrieve a Crystal Report
In this section, we use web service calls to the BusinessObjects system, you can find full documentation to the Crystal Reports web services in the SAP Crystal Reports RESTful Web Services Developer Guide.
Prerequisites
- The report is of type Crystal Reports for Enterprise, this is a limitation of the Crystal Reports Web Services API.
- Credentials with sufficient privileges for running the report.
- The
id
of the Crystal Report.- You can see the
id
of the report in CMC, report Properties.
- You can see the
- Redwood Server 9.2.8.8 or later.
Procedure
Retrieve the Logon Token
In Business Objects CMC, navigate to Applications > RESTfull Web Service, take note of the Access URL which will be referred to as <BO_URL>
in this procedure.
- Navigate to Definitions > Processes, choose New Process Definition, select HTTP/REST.
- Fill
GetLogonToken
in the Name field, see Source below for the source. - On the Parameters tab:
- In the HTTP_URL parameter, fill
<BO_URL>/logon/long
. - In the HTTP_Method parameter, fill
POST
. - Add a parameter named
Username
. - Add a parameter named
Password
, select Password in the Parameter Options to hide the password in the user interface. - Add a parameter named
AuthType
. - Add a parameter named
attr
with Direction Out; this parameter will contain the SAP logon token.
- In the HTTP_URL parameter, fill
- Choose Save & Close.
Retrieve a Report as PDF
- Navigate to Definitions > Processes, choose New Process Definition, select HTTP/REST.
- Fill
GetReportPDF
in the Name field, see GetReportPDF Source below for the source. - On the Parameters tab:
- In the HTTP_URL field, fill
<BO_URL>/infostore/5883/rpt/export?mime_type=application/pdf
. - In the HTTP_Method, fill
GET
. - Add a parameter named
LogonToken
.
- In the HTTP_URL field, fill
- On the Options tab, select PortableDocumentFormat in the Default Output Format field.
- Choose Save & Close.
Retrieve a Report as CSV
- Navigate to Definitions > Processes, choose New Process Definition, select HTTP/REST.
- Fill
GetReportCSV
in the Name field, see GetReportPDF Source below for the source. - On the Parameters tab:
- In the HTTP_URL field, fill
<BO_URL>/infostore/5883/rpt/export?mime_type=text/csv&delimiter=;&separator='&reportSectionsOption=1&groupSectionsOption=1
. - In the HTTP_Method, fill
GET
. - Add a parameter named
LogonToken
.
- In the HTTP_URL field, fill
- On the Options tab, select PortableDocumentFormat in the Default Output Format field.
- Choose Save & Close.
Log Out
- Fill
ReleaseLogonToken
in the Name field, see Source below for the source. - On the Parameters tab:
- In the HTTP_URL parameter, fill
<BO_URL>/logoff
. - In the HTTP_Method parameter, fill
POST
.
- In the HTTP_URL parameter, fill
- Choose Save & Close.
Create a Chain Definition
- Navigate to Definitions > Chains.
- Choose New Chain Definition.
- In the Name field, fill
JC_BOReport
. - On the Parameters tab:
- Add a parameter named
Username
. - Add a parameter named
Password
, select Password in the Parameter Options to hide the password in the user interface. - Add a parameter named
AuthType
, select List in the Simple Constraint Type field, fillsecEnterprise,secLDAP,secWinAD,secSAPR3
into the Simple Constraint Data field.
- Add a parameter named
- On the Diagram tab:
- Under Step 1, choose the first process and fill
GetLogonToken
into the Process Definition field. - Map parameters Username, Password, AuthType to their respective chain parameters.
- Add another step by choosing the
[+]
to the right of Step 1. - Fill
GetReportPDF
into the Process Definition field of process 1 of Step 2. - Map parameter LogonToken to parameter attr of GetLogonToken in the first step.
- Add another process to Step 2.
- Fill
GetReportCSV
into the Process Definition field of process 2 of Step 2. - Map parameter LogonToken to parameter attr of GetLogonToken in the first step.
- Add another step by choosing the
[+]
to the right of Step 2. - Fill
ReleaseLogonToken
into Process Definition field of process 1 of Step 3. - Map parameter LogonToken to parameter attr of GetLogonToken in the first step.
- Under Step 1, choose the first process and fill
- Choose Save & Close.
GetLogonToken Source
<attrs xmlns="http://www.sap.com/rws/bip">
<attr name="password" type="string">${Password}</attr><attr name="clientType" type="string"></attr>
<attr name="auth" type="string" possibilities="secEnterprise,secLDAP,secWinAD,secSAPR3">${AuthType}</attr>
<attr name="userName" type="string">${Username}</attr>
</attrs>
[headers]
Content-Type=application/xml
GetReportPDF Source
[Headers]
X-SAP-LogonToken=${LogonToken}
ReleaseLogonToken Source
[Headers]
X-SAP-LogonToken=${LogonToken}