cancel
Showing results for 
Search instead for 
Did you mean: 

Create Crystal Report Template using Crystal Reports for .NET Framework

Former Member
0 Kudos

Hi,

Under VS2003, P2smon.dll and is used to create Crystal Report templates in our desktop

application. The user will then use Crystal Report Designer to add fields and to specify layout, etc.

Then the desktop uses RDC to update the report and export to other applications formats, e.g pdf.

After upgrade to VS2010, we need to use Crystal Reports for .NET Framework 4.0 in C#. I have some question:

How to create an empty report with field definitions, any simple as P2smon.dll without involving "In Process Report Application Server"/"BusinessObjects Enterprise"/"Business Objects OEM Partner program"?

I really appreciate that I could get some instructions.

Thanks!

Wei

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Wei,

Download [Cr for VS 2010|http://www.sdn.sap.com/irj/boc/crystalreports-dotnet] and then use inProc RAS is the only Report Creation functionality now. Bottom of the page has all the info links.

Here's a link to the samples:

http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples

Bottom of that page has the RAS samples.

You don't need to use BOE or CRSE to use RAS but for scalability it is an option.

Don

Former Member
0 Kudos

Hi, Don:

Thanks for response so promptly!

The sample for creating report in the web site is a web/server. Is there some sample code for in-process RAS? Or could you kindly point me to the class with creating report function.

Also I read from SAP site that in-process RAS only available to OEM partner http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/10b840c0-623f-2b10-03b5-9d1913866b32. Is this still the case? How can one become an OEM partner?

Thanks you!

Wei

former_member183750
Active Contributor
0 Kudos

Have a look at the article [ How to Use The RAS SDK .NET With In-Process RAS Server|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10b840c0-623f-2b10-03b5-9d1913866b32]. That should give you enough guidance to start with InProc RAS. The APIs are the same be it InProc, win or web.

The developer help files are not too bad either:

[Report Application Server .NET API Guide|http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/xi4_rassdk_net_api_en.zip]

[Report Application Server .NET SDK Developer Guide|http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/xi4_rassdk_net_dg_en.zip]

- Ludek

Former Member
0 Kudos

Hi, Ludek:

Thanks fro the info!

I try to create a report similarly to that in the sample

private void CreateReport()

{

ReportClientDocument rcd = new CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument();

rcd.ReportAppServer = "localhost:port";

rcd.New();

string reportDirectory = "C:
Temp";

object reportDir = (object)reportDirectory;

rcd.SaveAs("MyNewUnmanagedReport.rpt", ref reportDir, (int)CdReportClientDocumentSaveAsOptionsEnum.cdReportClientDocumentSaveAsOverwriteExisting);

rcd.Close();

}

Because I do not have a server, rcd.ReportAppServer = "localhost:port"; did not for rcd.New(); What I should put in rcd.ReportServer for the server-less case?

Thank you!

Wei

0 Kudos

Hi Wei,

don't use that line:

rcd.ReportAppServer = "localhost:port";

Because it's inProc you don't need to specify one, only required if you are using Managed RAS.

Also, you are not loading a report....

Here's the code. I'm using the File Dialog box to get the report file:


		private void btnOpenReport_Click(object sender, System.EventArgs e)
		{
            rptClientDoc = new CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument(); // ReportClientDocumentClass();

            // this line uses the local PC as the RAS server/services running
            //rptClientDoc.ReportAppServer = "VMDWCR2k8RAS"; //System.Environment.MachineName;
            openFileDialog.Filter = "Crystal Reports (*.rpt)|*.rpt|Crystal Reports Secure (*.rptr)|*.rptr";
            //openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog.FilterIndex = 1;

			if (openFileDialog.ShowDialog() == DialogResult.OK) 
			{
				object rptName = openFileDialog.FileName;
                
                try
                {
                    // this one does not use crystalras.exe as a service
                    rpt.Load(rptName.ToString(), OpenReportMethod.OpenReportByTempCopy);
                    // this one uses RAS
                    //rpt.Load(Server.MapPath("" + Request.ApplicationPath) + @"\Reports\ChartComparison.rpt", OpenReportMethod.OpenReportByTempCopy);


                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR: " + ex.Message);
                    return;
                }
                // Sets the report to RAS Object
                rptClientDoc = rpt.ReportClientDocument;
...

You can then use rpt or rptClientDoc to make various changes etc...

Thanks

Don

Former Member
0 Kudos

Hi, Don:

I am able to create a blank report with following code :-). Thanks very much!

I need to add fields available for user to add to the report as P2smon.dll did. Suppose that I have myDatabase.mdb.

What is the fastest way to achieve it?

Is there a way to launch Crystal Reports Designer with the newly created report as P2smon.dll?

Thanks you!!

Wei

private void CreateReport()

{

ReportDocument rpt = new ReportDocument();

ISCDReportClientDocument rptClientDoc = rpt.ReportClientDocument;

rptClientDoc.New();

string reportDirectory = "C:
Temp";

object reportDir = (object)reportDirectory;

rptClientDoc.SaveAs("MyNewReport.rpt", ref reportDir, (int)CdReportClientDocumentSaveAsOptionsEnum.cdReportClientDocumentSaveAsOverwriteExisting);

rptClientDoc.Close();

}

0 Kudos

Hi Wei,

PLEASE look at the Report Creation ( RAS ) samples from the link I posted above.

There is no embedded report designer now, you have to create your own using RAS.

Don

Former Member
0 Kudos

Hi, Don:

I have figured out. I added a table to the empty report and set the access database as data source.

Thank you very much!

Wei

Answers (0)