SAP Knowledge Base Article - Public

1211733 - Converting Active Server Pages Applications from Version 7 to Version 8

Symptom

An ASP (Active Server Pages) application was developed using the version 7.0 Crystal Automation Server (Cpeaut32.dll). Crystal Reports 8.0 was installed and the application was converted to take advantage of the Report Designer Component's (Craxdrt.dll) capabilities. However, the application no longer displayed the report correctly after the modifications.

 

What are the steps that need to be taken to upgrade a version 7.0 ASP application to use the version 8.0 Report Designer Component through ASP?

 

Note: No changes to the version 7.0 application are needed if the version 8.0 ASP application is still going to use the Crystal Automation Server (Cpeaut32.dll) to serve reports. The version 7.0 ASP code only needs to be converted if the Craxdrt.dll is going to be used in the version 8.0 application.

Resolution

The ASP Reports Server for version 8.0 uses the Report Design Component (Craxdrt.dll) instead of the Crystal Automation Server (Cpeaut32.dll)(but Cpeaut32.dll can still be used for backwards compatibility reasons).

To convert the ASP code to use Craxdrt.dll for ASP applications serving Crystal Reports:

1. Change the line that creates the application object:

Set session ("oApp") = Server.CreateObject("Crystal.CRPE.Application")

To use the RDC object:

Set session ("oApp") = Server.CreateObject("CrystalRuntime.Application")

2. Comment out or remove the following lines:

Set oRptOptions = Session("oRpt").Options

oRptOptions.MorePrintEngineErrorMessages = 0

and replace with the following lines:

session("oRpt").MorePrintEngineErrorMessages = False

session("oRpt").EnableParameterPrompting = False

These lines suppress the print engine's error messages. The RDC does not access the print engine.

3. Replace the Rptserver.asp in the ASP application with the version that ships with version 8 (located in the ..\Program Files\Seagate Software\Crystal Reports\Samples\Code\Web\Active Server Pages directory). Failure to use the updated version may result in the error, "Could not create object", when calling the report to the browser. Failure to use the updated version may result in the error, "Could not create object", when calling the report to the browser.

4. Replace the Smartviewer*.asp file to install the new viewer. Remember to change the reference to Rptserver.asp to point to the file included in your application. The new viewer files are located in the ..\Program Files\Seagate Software\Crystal Reports\Samples\Code\Web\Active Server Pages directory.

5. Parameter field collection. Version 7 of Crystal reports allowed specifying the parameter name as a string as part of the parameter field definition collection for the "Item" property. For example:

set ParamCollection = Session("oRpt").ParameterFields

Set MyParam = ParamCollection.item("Parameter1Name")

Set MyParam2 = ParamCollection.item("Parameter2Name")

Set MyParam3 = ParamCollection.item("Parameter3Name")

A numeric index can also be used in place of the parameter name

i.e. Set ThisParam = ParamCollection.item(1)

Version 8 of Crystal reports does not support strings for the Index property. The index must be numeric and 1-based.

The proper syntax for the parameter field definition collection for the "Item" property in version 8 is:

set ParamCollection = Session("oRpt").ParameterFields

Set MyParam = ParamCollection.item(1)

Set MyParam2 = ParamCollection.item(2)

Set MyParam3 = ParamCollection.item(3)

6. For parameters that are used to link the subreports to the main report, no values need to be set. However, users should be careful that they set the correct parameters to the correct values. For example, suppose you open a report and find the list of parameters for the main report as:

Parameter #1 - Date parameter for report

Parameter #2 - Parameter used to link to subreport

Parameter #3 - String parameter for report

In this case you would set values for Parameter #1 and Parameter #3 only:

ParamCollection.item(1) = yourdatevalue

ParamCollection.item(3) = yourstringvalue

Notice the indexes are 1 and 3, and index 2 is simply ignored.

7. Under version 6 and 7 the name of subreports could be returned by the subreport object's .name property.

i.e. Version 7

Set CRSubreports=session("oRpt").OpenSubreport("MySubreport")

Response.write CRSubreports.Name

For version 8 it has been changed to SubreportName

i.e. set CRSubreports=session("oRpt").OpenSubreport("MySubreport")

Response.write CRSubreports.SubreportName

Keywords

COULD NOT CREATE OBJECT ASP REPORT DESIGNER COMPONENT RDC CPEAUT AUTOMATION Seagate Crystal Reports WEB Crystal Automation Server (ASP) Report Design Component , c2006178 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports 8.0