Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Introduction
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. Configuring the OC4J Runtime Environment for Oracle Reports Assuming that Oracle Reports 10g is installed on your PC, the following steps will ensure that you are able to successfully use Oracle Reports in your OC4J runtime environment.
have as many as you need. (property name="sourceDir" value="c:\env\aap\reports;c:\env\eu_asc\reports;) 5. Save and close the file. Modifying the Application .env file The third and final step is modifying each application .env file including a variable specifying the reports path. Here is what you need to do: 1. Open Windows Explorer and navigate to c:\\forms90\server 2. Open one of the application.env files that you have created using a text editor. 3. Add the REPORTS_PATH variable, setting its' value to the location of that applications report directory as shown in the example below: REPORTS_PATH=c:\env\aap\reports 4. Save and close the file. 5. Repeat for each remaining application.env file.
DECLARE v_host varchar2(100); v_port varchar2(10); v_parameter_string varchar2(4000); 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); -- Get the username/password and database from the .env file tool_env.getvar('APPLICATION_USERNAME',v_username); tool_env.getvar('APPLICATION_PASSWORD',v_password); tool_env.getvar('APPLICATION_DATABASE',v_database); -- 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; -- Now build the parameter string for running the report v_parameter_string := 'server=rep_fsprod'; v_parameter_string := v_parameter_string||'&report=AAP_TOTAL_CONTRACT_VALUE_RPT.rdf'; v_parameter_string := v_parameter_string||'&userid='||v_username||'/'||v_password||'@'||v_database; v_parameter_string := v_parameter_string||'&execution_mode=batch'; v_parameter_string := v_parameter_string||'&comm_mode=synchronous'; v_parameter_string := v_parameter_string||'&destype=cache'; v_parameter_string := v_parameter_string||'&desformat=pdf'; v_parameter_string := v_parameter_string||'&p_region='||:rpt_parms.region; v_parameter_string := v_parameter_string||'&p_province='||:rpt_parms.province; v_parameter_string := v_parameter_string||'&p_forest='||:rpt_parms.forest; v_parameter_string := v_parameter_string||'&p_district='||:rpt_parms.district; v_parameter_string := v_parameter_string||'&p_fiscal_year='||:rpt_parms.fiscal_year;
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.
And add a report object in the form. ( in the above code, its REPORT_OBJ ).