Beruflich Dokumente
Kultur Dokumente
u
Oracle Reports can add some great reporting functionality to your 10g Forms applications making data
available in a wide variety of output formats such as XML and PDF. In this document I will explain how to
configure 10g Oracle Reports on your PC, how to call Oracle Reports from 10g Forms applications, and
application server deployment considerations. This information should advance your usage of Oracle
Reports and speed adaptation in your applications.
3
The first step is to define a report server. This server will run in your OC4J runtime environment handling
all Oracle Report execution requests. You will not be able to run reports in a 10g application unless you
have defined and started a Report server. To define a report server do the following:
Congratulations you just defined a report server! You should now see a dialog box indicating the Report
Server is initializing.
The second step is to configure the Report Server created in step 1. Specifically you need to specify the
Source Directory of the report files as a search path for the Report Server to use when individual report
requests are made. Here is what you need to do:
v_username varchar2(50);
v_password varchar2(50);
v_database varchar2(50);
BEGIN
-- Get the full domain name of the server from the formsweb.cfg
tool_env.getvar('SERVER_URL',v_host);
-- If it is localhost then we are running on windows and need to use the windows port, otherwise we
-- are on AIX and need to use the AIX port
IF v_host = 'localhost' THEN
v_port := '8889';
ELSE
v_port := '7778';
END IF;
END;
There are a couple of important items to note when reviewing this program unit:
1. Important data elements are not hard coded! Instead, they are stored in the application.env file and
referenced at runtime using tool_env.get_var. The username, password, database and server are all
referenced this way.
2. The program unit supports execution on Windows (my development platform) and AIX (the
deployment platform) without requiring any code modifications.
a. By referencing the SERVER_URL environment variable in the application.env file, I am able to specify
the server and port dynamically.
3. When building the string of parameters to be passed you need to:
a. Include the report name as a parameter
b. Prepend an '&' to second parameter and any additional parameters thereafter.
c. Except for the report name, be sure that all additional parameters specified match a parameter name
(system or user) in the Report definition.
4. Mandatory parameters for each report include:
a. Server, report, userid, execution_mode, comm_mode, destype and desformat.
i. Report is the only parameter that will change. The others (likely) will remain constant for all reports in
your application.
When the WEB.SHOW_DOCUMENT command is issued from the Form, a new browser window is
opened and the request is executed by the Report Server.
First, it is important to note that the Oracle reports in your application need to be deployed in the
/reports subdirectory such as /fsapps/fsprod/leimars/reports.
Be sure to have your application.env file modified accordingly by having the REPORTS_PATH variable
specify the proper location.
The second and most important item to note is that the rep_fsprod.conf file will not be modified to
include each applications /reports directory. Instead the reports in each applications /reports directory
are linked to /fsapps/fsprod/fs_reports by an eDBA using a standard utility that has been distributed on
each application server. Each time the script is run on a particular /reports directory, symbolic links are
created for each report. If you add a new report, you need to have the links created for your application
before it will be available.
The third and final thing to note is that Report Definitions do not need to be compiled when you deploy
to the application server. Simply move the .rdf file to you application /reports directory, have the links
recreated and you are good to go.
Conclusion
You now have the information you need to include Oracle Reports in your 10g Forms applications.
It is a fairly painless process to complete if your application calls for this functionality.
I hope that you found the contents of this paper useful and wish you good luck.
DECLARE
RO_Report_ID REPORT_OBJECT;
Str_Report_Server_Job VARCHAR2(100);
Str_Job_ID VARCHAR2(100);
Str_URL VARCHAR2(100);
PL_ID PARAMLIST ;
BEGIN
PL_ID := GET_PARAMETER_LIST('TEMPDATA');
IF NOT ID_NULL(PL_ID) THEN
DESTROY_PARAMETER_LIST(PL_ID);
END IF;
PL_ID := CREATE_PARAMETER_LIST('TEMPDATA');
RO_Report_ID := FIND_REPORT_OBJECT('REPORT_OBJ');
ADD_PARAMETER(PL_ID, 'EMP_ID', TEXT_PARAMETER, <value to EMPID parameter>);
--FOLLOWING PARAMETERS ARE MANDATORY PARAMETERS TO SET REPORT OBJECT
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_FILENAME, '<report_full_path>');
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_EXECUTION_MODE, BATCH);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_DESTYPE, FILE);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_DESFORMAT, 'PDF');
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_SERVER, <report_server_name>);
Str_Report_Server_Job := RUN_REPORT_OBJECT(RO_Report_ID, PL_ID);
Str_Job_ID := SUBSTR(Str_Report_Server_Job, LENGTH(<report_server_name>) + 2,
LENGTH(Str_Report_Server_Job));
Str_URL := '/reports/rwservlet/getjobid' || Str_Job_ID || '?server=' ||
<report_server_name>;
WEB.SHOW_DOCUMENT(Str_URL, '_SELF');
DESTROY_PARAMETER_LIST(PL_ID);
END IF;
END;
And add a report object in the form. ( in the above code, its ).