我需要实现从用户通过Oracle Forms应用程序引入的一些参数生成报告的功能。
该实用程序内置在表单内的代码单元中:
PACKAGE BODY INVOICES_MANAGEMENT IS
-- Generate Invoices Report
PROCEDURE GENERATE_INVOICES_REPORT (
P_REPORTNAME IN VARCHAR2,
P_FORMAT IN VARCHAR2,
P_REPORT_SERVER IN VARCHAR2,
P_MINYEAR IN INTEGER,
P_MAXYEAR IN INTEGER) IS
v_report_id Report_Object;
-- Unique id for each Report request
v_report_server_job VARCHAR2(100);
-- Status of the Report job
v_rep_status VARCHAR2(100);
-- job_id as number only string
v_job_id VARCHAR2(100);
-- Param List
v_tmp_plid ParamList;
v_hidden_action VARCHAR2(200);
BEGIN
v_tmp_plid := Get_Parameter_List('RepData');
IF NOT ID_NULL(v_tmp_plid) THEN
DESTROY_PARAMETER_LIST( v_tmp_plid );
END IF;
v_tmp_plid := CREATE_PARAMETER_LIST ('RepData');
-- Get a handle to the Report Object
v_report_id := FIND_REPORT_OBJECT(P_REPORTNAME);
/* Define the report output format and the name of the Reports Server as well as a user-defined parameter. */
SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_DESFORMAT, P_FORMAT);
SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_DESTYPE, CACHE);
SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_SERVER, P_REPORT_SERVER);
--SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_OTHER, 'MIN_YEAR='||P_MINYEAR||' MAX_YEAR=' || P_MAXYEAR || ' paramform=no');
Add_Parameter(v_tmp_plid, 'MIN_YEAR', TEXT_PARAMETER, P_MINYEAR );
Add_Parameter(v_tmp_plid, 'MAX_YEAR', TEXT_PARAMETER, P_MAXYEAR );
v_hidden_action := 'userid=' ||
--get_application_property(username)
'sergio11' || '/' ||
--get_application_property(password)
'bisite00' || '@' || 'XE';
--get_application_property(connect_string);
MESSAGE('HIDE ACTION -> ' || v_hidden_action);
SET_REPORT_OBJECT_PROPERTY (v_report_id, REPORT_OTHER, v_hidden_action);
-- Run Report
v_report_server_job := RUN_REPORT_OBJECT(v_report_id, v_tmp_plid);
v_job_id := substr(v_report_server_job, instr(v_report_server_job, '_' , -1)+1);
LOOP
v_rep_status := REPORT_OBJECT_STATUS(v_report_server_job);
EXIT WHEN v_rep_status IN ('FINISHED', 'TERMINATED_WITH_ERROR');
END LOOP;
IF v_rep_status = 'FINISHED' THEN
/* Call the Reports output to be displayed in the browser. The URL for relative addressing is valid
only when the Reports Server resides on the same host as the Forms Server and is accessed via the same port.
For accessing a remote Reports environment, you must use a fully qualified URL (i.e. http://hostname:port ) */
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| v_job_id || '?server='|| P_REPORT_SERVER, '_blank');
ELSE
MESSAGE('Report failed with error message '|| v_rep_status);
END IF;
END;
END;
使用“生成”按钮时将执行此过程,然后用户应该能够下载带有发票列表的pdf文件。
接下来我公开SmartTrigger的代码'WHEN-BUTTON-PRESSED'
DECLARE
v_minyear INTEGER;
v_maxyear INTEGER;
v_reportname VARCHAR2(30) DEFAULT 'INVOICES_REPORT';
v_format VARCHAR2(10) DEFAULT 'PDF';
v_reportserver VARCHAR2(15) DEFAULT 'rep_ie8win7';
BEGIN
v_minyear := :MIN_YEAR_TEXT;
v_maxyear := :MAX_YEAR_TEXT;
-- Generate Invoice Report
INVOICES_MANAGEMENT.GENERATE_INVOICES_REPORT ( v_reportname, v_format,
v_reportserver, v_minyear, v_maxyear);
END;
答案是立竿见影的,“FRM - 41214无法运行报告”会抛出 TERMINATED_WITH_ERRORS 状态。
在咨询从Oracle Forms应用程序启动的“作业”的状态时,我发现问题的根源是错误“REP-501:无法连接到指定的数据库。”
考虑
TNS_ADMIN - > C:\ oraclexe \应用\ ORACLE \产品\ 11.2.0 \服务器\网络\管理员
从Oracle Reports Builder我可以正确生成报告,我 已将此报告导出为二进制文件“。rep”以将其包含为 表格中的“报告”对象。
我试图通过提供完整的连接字符串 userid 参数。
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER,'userid ='|| get_application_property(username)||'/'|| get_application_property(password)||'@'|| get_application_property(connect_string));
我正在使用Oracle Application Server 10g。
有人可以帮我解决这个问题吗?
谢谢