cancel
Showing results for 
Search instead for 
Did you mean: 

How Can I Launch CR To Print A Report Then Close

Former Member
0 Kudos

I use report_viewer to run CR .rpt files from a Progress Application. When launched CR presents the report on the screen for the user to view/print. Can I run this report in a way that just goes directly to a printer and does not display on the screen? I just want to print the report and then have the CR session close. All this without the user ever seen CR. Don

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thank you for the replies! I am a software developer and work with the Progress 4GL programming language. As well I have the Developer edition of CR. What needs to be done to "report_Viewer" in order to launch the report directly to the printer and bypass the entire CRT screen presentation? I want the user to press a button in our application and have the report print without the user seeing anything on the CRT. Again, thank you for your assistance!

0 Kudos

Hi Don,

So you are using the RDC ( craxdrt.dll ) as your report engine correct? So I moved this to the Legacy forum.

If you go to our RDC samples you'll find samples, they are VB but same methods, on how to print the report from the RDC engine and not the viewer. The viewer has a button to print only.

It should be something like ReportObject.PrintReport( other properties)

Thank you

Don

Former Member
0 Kudos

Don, thank you for help. I have to confess getting lost in the website. Can you post a link to the code sample for direct printing. I'll continue searching the site, but a link would be most helpful.

The code I'm presently using to view the report is:

chCtrlFrame:CrystalActiveXReportViewer:ReportSource=chReport.

chCtrlFrame:CrystalActiveXReportViewer:ViewReport().

former_member183750
Active Contributor
0 Kudos

I think Don was looking at [this|http://www.sdn.sap.com/irj/boc/index?rid=/webcontent/uuid/a01c839a-7787-2b10-88a2-c8c7b894df9e] [original link is broken]; downloads page. Unfortunately , I don't see much there so unless Don comes back with some other page, that is it.

Seeing the lack of actual sample apps, you'll have to dive into the Developer help which should be installed on your dev computer;

C:Program FilesBusiness ObjectsCrystal Reports 11.5Helpen dcsdk_com_dg_docdoc dcsdk_com_dg.chm

In a nut shell the following line of code should print the report - as long as it is logged on to the database (unless it is a saved data report) and all other parameters the report expects have been supplied:

report.PrintOut([PromptUser], [numberOfCopy], [collated], [startPageN], [stopPageN])

You can select a printer to print to;

report.SelectPrinter "DriverName", "PrinterName", "Portname"

There are other print properties you can set. See the dev help above and the article below for more details. In all of this, it is absolutely critical that you are working with [SP 6|https://smpdl.sap-ag.de/~sapidp/012002523100015859952009E/crxir2win_sp6.exe] as htere have been a number of fixes pertaining to printing.

Hunting for other possible sources of info;

[How Visual Basic Developers can Migrate from the OCX to the Report Designer Component as Their Primary Integration Method|http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/a06bac06-9d1e-2b10-5ebc-c518a91c0dc5?quicklink=index&overridelayout=true]

While the above is targeted at converting from OCX to RDC, it has great info re. working with printers and RDC.

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Former Member
0 Kudos

Kudek, Thank you for the reply! I wasn't able to find a solution in your response as I am presently doing what you suggested.

Below is the code (Progress 4GL) that I'm using to launch the report. It brings the report to the user screen and automatically directs the printout to the appropriate printer. I'm trying to get it to go to the printer without displaying anything on the screen.

The last call, is the one that is presenting it to the CRT. I must have to replace the "ReportViewer:ViewReport()" with a different call to bypass the display step and go directly to the printer, but I don't know what to use.

Again, any help is very much appreciates.

chReport= chApplication:OpenReport("c:\dcam\reports\pack_list.rpt").

chCtrlFrame:CrystalActiveXReportViewer:EnableExportButton = TRUE.

chCtrlFrame:CrystalActiveXReportViewer:EnableSearchControl = FALSE.

chCtrlFrame:CrystalActiveXReportViewer:EnableGroupTree = FALSE.

/* Clear Report Parameter */

chReport:ParameterFields:ITEM(1):ClearCurrentValueAndRange().

/* Set Report Parameter */

chReport:ParameterFields:ITEM(1):SetCurrentValue(rep-lid-no).

chReport:SelectPrinter("", rep-printer, "").

chReport:PrintOut(FALSE).

/* Set the report name */

chCtrlFrame:CrystalActiveXReportViewer:ReportSource=chReport.

/* View Report */

chCtrlFrame:CrystalActiveXReportViewer:ViewReport().

former_member183750
Active Contributor
0 Kudos

Umm, if we don't want the viewer, what about removing any reference and / or code for it? E.g.;

chReport= chApplication:OpenReport("c:\dcam\reports\pack_list.rpt").

/* Clear Report Parameter */

chReport:ParameterFields:ITEM(1):ClearCurrentValueAndRange().

/* Set Report Parameter */

chReport:ParameterFields:ITEM(1):SetCurrentValue(rep-lid-no).

chReport:SelectPrinter("", rep-printer, "").

chReport:PrintOut(FALSE).

What am I missing here?

Ludek

Former Member
0 Kudos

I'm still struggling. When I execute the "PrintOut" call I'm getting an error return of "210015".

Can you post (or point me to) sample VB code that performs this function?

former_member183750
Active Contributor
0 Kudos

C:\Program Files\Business Objects\Crystal Reports 11.5\Help\en\rdcsdk_com_dg_doc\doc\rdcsdk_com_dg.chm

Also try a different printer driver and or see if there are any updates for your current printer driver.

Ludek

Former Member
0 Kudos

Ludek & Don

I got it to work! All the difficulty I was having was a bad DSN connection that was masked by an erroneous error return code that looked like a printer problem. My "direct to printer" code was always working, but the ODBC connection failure was not being trapped properly and causing the ap to abort with a bad return code. I finally was able to unravel this. Once I determined the root problem the rest fell into place.

I can't thank you enough! Your efforts are very much appreciated!

Don

former_member183750
Active Contributor
0 Kudos

Nice to hear it's finally done.

Have a great weekend,

Ludek

Answers (1)

Answers (1)

0 Kudos

Hi Don,

We don't have anything like that as a standalone app.

You could write your own but it would require a Developer and quite simple to do. Lots of options. A web server/application would be the easiest.

There are also third party applications available to do the same also.

Thank you

Don

ido_millet
Active Contributor
0 Kudos

For a list of 3rd-party applications that provide this functionality, see http://www.kenhamady.com/bookmarks.html