[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1666
  • Last Modified:

Launch Crystal Reports from Oracle Forms 6i

I want t to launch a Crystal Report from Oracle Forms 6i using a button event. How can I do this?

Thanks in advance

Jorge
0
jpolanco
Asked:
jpolanco
1 Solution
 
Muhammad Ahmad ImranDatabase DeveloperCommented:
There is a package DDE.app_begin use it to run crystal reports or whatever application that supported in operating system. You can find forms help for an example.
0
 
sujit_kumarCommented:
From Metalink site:

Problem Description
===================
 
How to print a Crystal Report from Oracle Forms?
 
Solution
=========
 
1)  In the layout editor, create a new data block and name it OCXBLOCK
2)  In the property palette for the OCXBLOCK set Records -> Single Record to Yes and Database -> Database Data Block to No
3)  Create a new ActiveX control in the OCXBLOCK data block
4)  Right-click on the ActiveX control and click Insert Object
5)  Select Crystal Report Control from Insert Object dialog and click OK
6)  In Object Navigator, double-click the new ActiveX object to display the Property Palette
7)  Change General -> Name to CRYSOCX and Database -> Database Item to No and Physical -> Visible to No
8)  On Program menu select Import OLE Library Interfaces
9)  Select Crystal.CrystalReport from Import OLE dialog, select (highlight) all methods and properties, click OK
10) Enter code into the KEY-PRINT trigger on the form similar to the following:
 
/*
** Invoke Crystal Report Control to perform the
** print function for this form.
*/
DECLARE
   sReportName            VARCHAR2(64);
   sReportDesc            VARCHAR2(50);
   sReportTable           VARCHAR2(64);
   sReportPath            VARCHAR2(64);
   sUserName              VARCHAR2(16);
   sPassWord              VARCHAR2(16);
   sDataBase              VARCHAR2(64);
   sConnect               VARCHAR2(96);
   sWhere                 VARCHAR2(64);
                           
BEGIN
-- Retrieve the Log in information.
sUserName := GET_APPLICATION_PROPERTY (USERNAME);
sPassWord := GET_APPLICATION_PROPERTY (PASSWORD);
sDataBase := GET_APPLICATION_PROPERTY (CONNECT_STRING);
sConnect := 'DSN=' || sDataBase || ';UID=' || sUserName || ';PWD=' ||
sPassWord || ';DSQ=';
 
-- Retrieve the report information
SELECT RPT_PATH, RPT_FILENAME, RPT_DESC, RPT_TABLE_NAME INTO
sReportPath, sReportName, sReportDesc, sReportTable FROM
RPT_LIST WHERE RPT_NBR = Num;  /* Where Num is a number*/
 
-- Set the OCX up to execute
CRYSTAL_CRYSTALCTRL.ReportFileName(:item('OCXBLOCK.CRYSOCX').interface,
sReportPath || sReportName);
CRYSTAL_CRYSTALCTRL.WindowTitle(:item('OCXBLOCK.CRYSOCX').interface,
sReportDesc);
CRYSTAL_CRYSTALCTRL.WindowState(:item('OCXBLOCK.CRYSOCX').interface,
CRYSTAL_CONSTANTS.crptMaximized);
CRYSTAL_CRYSTALCTRL.ole_Connect(:item('OCXBLOCK.CRYSOCX').interface,
sConnect);
 
-- Load the arguments - this section should be set to be specific to each form
 
sWhere := '{' || sReportTable || '.CHAIN_NBR}=' ||
TO_CHAR(:SLSCHAINPF.Chain_Nbr);
CRYSTAL_CRYSTALCTRL.SelectionFormula(:item('OCXBLOCK.CRYSOCX').interface,
sWhere);
 
-- Execute the report!
CRYSTAL_CRYSTALCTRL.Action(:item('OCXBLOCK.CRYSOCX').interface, 1);
 
EXCEPTION
   WHEN OTHERS THEN
        MESSAGE ('An Error has occurred. ');
 
END;
0
 
jpolancoAuthor Commented:
sujit_kumar:

I followed the steps described by in your comment and it even opens up the crystal report viewer for a short time but then it closes and closes the form also. I used the debugger and found out it crashes when it executes the report:

CRYSTAL_CRYSTALCTRL.Action(:item('OCXBLOCK.CRYSOCX').interface, 1);

No error message is generated, the form just closes.

Any Ideas?

Thx

leoahmad:
Thanks for your comment. I think I can´t use DDE because the crystal reports are not executable.  I´d have to create something like a VB wrapper to use the Activex Control
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now