OE 10.1 and Crystal Reports

I have a legacy character progress application (WDS-II) and would like to create a process to generate customer packing slips for orders using a centralized Crystal reports. Has anyone done this before? We are running OE10.1B03 on 64 bit Linux (soon to upgarde to OE10.2A). We have 4 locations and would like to centralize a Crystal report system for handling the printing of packing slips so any customization can be done in one spot. Any info on the best way to implement this would be great. Please include the best way for Crystal to communicate with OE.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Centralized Crystal reports

Hi,

In this following code will be useful for your Requirement... in SystemParam Table we will Store the Default Centralized Crystal reports Path, From there we will Get the path and add with Report template Name after that we will use that in "OpenReport" .

DEF VAR AxViewer_Handle AS COM-HANDLE NO-UNDO.
DEF VAR chApplication AS COM-HANDLE NO-UNDO.
DEF VAR chDocument AS COM-HANDLE NO-UNDO.
DEF VAR chDatabase AS COM-HANDLE NO-UNDO.
DEF VAR chParamDefs AS COM-HANDLE NO-UNDO.
DEF VAR PrintStatus AS LOGICAL.
DEF VAR RptPath AS CHAR.

DEFINE VARIABLE pc-drivername as CHARACTER NO-UNDO.
DEFINE VARIABLE pc-printername AS CHARACTER NO-UNDO.
DEFINE VARIABLE pc-printerport AS CHARACTER NO-UNDO.

SET RptPath = "".
FIND SysParam WHERE SysParam.CompCode = G-CompCode AND SysParam.SOURCE = "ALL"
AND SysParam.TranType = "RPT" NO-ERROR.
IF AVAILABLE SysParam THEN
DO:
SET RptPath = SysParam.PValue1 . /* SysParam.TranType SysParam.Comment SysParam.CompCode */
END.

IF RptPath = "" THEN
DO:
MESSAGE "Please Enter the Report Path Using ReportPath.W " VIEW-AS ALERT-BOX.
RETURN NO-APPLY.
END.

IF RptPath <> "" THEN
DO:
CREATE "CrystalRuntime.Application.11" chApplication.

chDocument = chApplication:OpenReport( RptPath + "DocPrec.rpt") NO-ERROR.

chDatabase = chDocument:DATABASE.
chParamDefs = chDocument:ParameterFields.

chDocument:Database:LogOnServer(
'pdsodbc.dll',
'apsh_hisdb',
'':U /* ttCrystal.DatabaseName - CR gives errors when using dbname */,
'sysprogress',
'sysprogress').

chDocument:Database:LogOnServer(
'pdsodbc.dll',
'apsh_Sysdb',
'':U /* ttCrystal.DatabaseName - CR gives errors when using dbname */,
'sysprogress',
'sysprogress').

chParamDefs:Item(1):SetCurrentValue(STRING(G-CompCode)).

chParamDefs:Item(2):SetCurrentValue(lblPreCode:SCREEN-VALUE).

chDocument:EnableParameterPrompting = TRUE.

IF pc-drivername = "":U OR pc-drivername = ? OR pc-printername = "":U OR pc-printername = ?
OR pc-printerport = "":U OR pc-printerport = ? THEN
DO:
SYSTEM-DIALOG PRINTER-SETUP
UPDATE PrintStatus.

ASSIGN
pc-drivername = SESSION:PRINTER-NAME
pc-printername = SESSION:PRINTER-NAME
pc-printerport = SESSION:PRINTER-PORT.

IF PrintStatus = YES THEN
DO:

chDocument:SelectPrinter (pc-drivername,pc-printername,pc-printerport).
chDocument:PrintOut(FALSE).

END.

END.

chParamDefs:Item(1):ClearCurrentValueAndRange().
chParamDefs:Item(2):ClearCurrentValueAndRange().

RELEASE OBJECT chApplication.
RELEASE OBJECT chDocument.
END.