ptreves
asked on
WebForms calling WebReports
Hello,
I have read that system parameters cannot be passed to a parameter list when Forms call Reports over the Web in Oracle 9i.
After using the FMA to migrate my code from ORacle 6i to 9i, I made the following modificaitons to allow me to print my reports over the WEb to my Network Printer installed on my Linux server.
HEre is the sample code:
-----
---repid := find_report_object('btprti nv');
---add_parameter(pl_id,'PA RAMFORM',T EXT_PARAME TER,'YES') ;
--System Parameters not part of Parameter List
--add_parameter(pl_id,'DES TYPE',TEXT _PARAMETER ,'PRINTER' );
--add_parameter(pl_id,'DES TYPE',TEXT _PARAMETER ,'PRINTER' );
---add_parameter(pl_id,'CO PIES',TEXT _PARAMETER ,'2');
--add_parameter(pl_id,'DES NAME',TEXT _PARAMETER ,'Lexmark Upper Tray');
--add_parameter(pl_id,'DES NAME',TEXT _PARAMETER ,'lxut');
---set_report_object_prope rty(repid, report_destype, printer);
---set_report_object_prope rty(repid, report_desname, 'lexmark lower tray');
---set_report_object_prope rty(PARAME TER.rp2rro destype,re port_desty pe,printer );
---set_report_object_prope rty(PARAME TER.rp2rro desname,re port_desna me,'lexmar k lower tray');
---add_parameter(pl_id,'P_ PRINT_DATE ',TEXT_PAR AMETER,to_ char(:vari able.print _date));
---add_parameter(pl_id,'P_ PROJECT',T EXT_PARAME TER,:varia ble.projec t);
---add_parameter(pl_id,'P_ CO',TEXT_P ARAMETER,: company.co );
---add_parameter(pl_id,'P_ SURVEYOR', TEXT_PARAM ETER,to_ch ar(:variab le.surveyo r));
---rp2rro.rp2rro_run_produ ct(REPORTS ,'btprtinv ',SYNCHRON OUS,RUNTIM E,FILESYST EM,pl_id,n ull);
repid := find_report_object('btprti nv');
set_report_object_property (repid, report_destype, printer);
set_report_object_property (repid, report_desname, 'lxut');
set_report_object_property (repid, report_other, 'paramform=yes ' || 'copies=2' ||
'P_PRINT_DATE=' || to_char(:variable.print_da te) ||
'P_PROJECT=' || :variable.project ||
'P_CO=' || :company.co ||
'P_SURVEYOR=' || to_char(:variable.surveyor ));
v_rep := run_report_object(repid);
rep_status := report_object_status(v_rep );
while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED') loop
rep_status := report_object_status(v_rep );
end loop;
if rep_status = 'FINISHED' then
-- display the report in the browser
rep_url := 'http://Linux2005:7780/reports/rwservlet/getjobid' ||
substr(v_rep, instr(v_rep, '_', -1) +1) ||
'?'||'server=rep_Linux2005 ';
web.show_document(rep_url, '_blank');
else
message('Error when running the report', 1);
end if;
end if;
destroy_parameter_list(pl_ id);
-----
I cannot compile the instructions report_object_status.
1) Any ideas why ?
This is how my variables are initialised:
pl_id PARAMLIST;
repid report_object;
v_rep VARCHAR2(100);
rep_status VARCHAR2(100);
rep_url varchar2(500);
2) I cannot invoke/run my report in my Oracle 9i iDS.
I had noticed that I was making referenc yo a reports server called RepSRV which I launched.
I check that my report called btprtinv.rep exists.
3) How can I go about resolving this issue ?
PT
I have read that system parameters cannot be passed to a parameter list when Forms call Reports over the Web in Oracle 9i.
After using the FMA to migrate my code from ORacle 6i to 9i, I made the following modificaitons to allow me to print my reports over the WEb to my Network Printer installed on my Linux server.
HEre is the sample code:
-----
---repid := find_report_object('btprti
---add_parameter(pl_id,'PA
--System Parameters not part of Parameter List
--add_parameter(pl_id,'DES
--add_parameter(pl_id,'DES
---add_parameter(pl_id,'CO
--add_parameter(pl_id,'DES
--add_parameter(pl_id,'DES
---set_report_object_prope
---set_report_object_prope
---set_report_object_prope
---set_report_object_prope
---add_parameter(pl_id,'P_
---add_parameter(pl_id,'P_
---add_parameter(pl_id,'P_
---add_parameter(pl_id,'P_
---rp2rro.rp2rro_run_produ
repid := find_report_object('btprti
set_report_object_property
set_report_object_property
set_report_object_property
'P_PRINT_DATE=' || to_char(:variable.print_da
'P_PROJECT=' || :variable.project ||
'P_CO=' || :company.co ||
'P_SURVEYOR=' || to_char(:variable.surveyor
v_rep := run_report_object(repid);
rep_status := report_object_status(v_rep
while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED') loop
rep_status := report_object_status(v_rep
end loop;
if rep_status = 'FINISHED' then
-- display the report in the browser
rep_url := 'http://Linux2005:7780/reports/rwservlet/getjobid' ||
substr(v_rep, instr(v_rep, '_', -1) +1) ||
'?'||'server=rep_Linux2005
web.show_document(rep_url,
else
message('Error when running the report', 1);
end if;
end if;
destroy_parameter_list(pl_
-----
I cannot compile the instructions report_object_status.
1) Any ideas why ?
This is how my variables are initialised:
pl_id PARAMLIST;
repid report_object;
v_rep VARCHAR2(100);
rep_status VARCHAR2(100);
rep_url varchar2(500);
2) I cannot invoke/run my report in my Oracle 9i iDS.
I had noticed that I was making referenc yo a reports server called RepSRV which I launched.
I check that my report called btprtinv.rep exists.
3) How can I go about resolving this issue ?
PT
ASKER
Hello,
Could the problem be related to the fact that maybe v_rep is NULL and not referencing the proper Report node ?
PT
Could the problem be related to the fact that maybe v_rep is NULL and not referencing the proper Report node ?
PT
Yes, of course.
ASKER
Hello,
I have been working on the Forms invoking Reports over the Web part of my application.
I set the system paramters DESTYPE and DESNAME with the set_system as follows before setting variables through the parameter list:
-----
/************************* ********** ********
Code modified by the Forms Migration Assistant
12-Sep-2004 03:07 PM
************************** ********** *******/
PROCEDURE Print_transaction IS
pl_id PARAMLIST;
repid report_object;
v_rep VARCHAR2(200);
rep_status VARCHAR2(200);
rep_url varchar2(500);
BEGIN
pl_id := Get_parameter_list('TRANSA CTION');
if not id_null(pl_id)
then destroy_parameter_list(pl_ id);
end if;
---'repid := find_report_object('btrepp ro');
repid := find_report_object('BTPRTI NV');
pl_id := Create_parameter_list('TRA NSACTION') ;
set_report_object_property (repid, report_comm_mode, synchronous);
set_report_object_property (repid, report_execution_mode, batch);
set_report_object_property (repid, report_destype, cache);
set_report_object_property (repid, report_desname, 'PDF');
--set_report_object_proper ty(repid, report_desname, 'Lexmark Upper Tray');
set_report_object_property (repid, report_server, 'RepSRV');
---set_report_object_prope rty(repid, report_other, 'paramform=yes ' || 'copies=2' ||
--- 'P_PRINT_DATE=' || to_char(:variable.print_da te) ||
--- 'P_PROJECT=' || :variable.project ||
--- 'P_CO=' || :company.co ||
--- 'P_SURVEYOR=' || to_char(:variable.surveyor ));
add_parameter(pl_id,'PARAM FORM',TEXT _PARAMETER ,'NO');
--add_parameter(pl_id,'DES TYPE',TEXT _PARAMETER ,'printer' );
--add_parameter(pl_id,'DES NAME',TEXT _PARAMETER ,'Lexmark Upper Tray');
add_parameter(pl_id,'COPIE S',TEXT_PA RAMETER,'1 ');
----add_parameter(pl_id,'P _PRINT_DAT E',TEXT_PA RAMETER,to _char(:var iable.prin t_date));
----add_parameter(pl_id,'P _PROJECT', TEXT_PARAM ETER,:vari able.proje ct);
----add_parameter(pl_id,'P _CO',TEXT_ PARAMETER, :company.c o);
-- add_parameter(pl_id,'P_SUR VEYOR',TEX T_PARAMETE R,nvl(to_c har(:varia ble.survey or),'0'));
--- rp2rro.rp2rro_run_product( REPORTS,'b treppro.re p',SYNCHRO NOUS,RUNTI ME,FILESYS TEM,pl_id, null);
message('Ok, Parameter List + Report Object Set', 1);
v_rep := run_report_object(repid, pl_id);
if v_rep is not null then
rep_status := report_object_status(v_rep );
message('Report Status Loop....Wait....', 1);
while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED') loop
rep_status := report_object_status(v_rep );
end loop;
message('Ok, Trying to run over the Web', 1);
if rep_status = 'FINISHED' then
-- display the report in the browser
rep_url := 'http://terrain2004:8888/reports/rwservlet/getjobid' ||
substr(v_rep, instr(v_rep, '_', -1) +1) ||
'?'||'server=RepSRV';
web.show_document(rep_url, '_blank');
elsif rep_status = 'TERMINATED_WITH_ERROR' then
message('TERMINATED_WITH_E RROR, Error when running the report', 1);
else
message('Some other Error when running the report', 1);
end if;
else
message('Report object not valid', 1);
end if;
destroy_parameter_list(pl_ id);
END;
=====
When I run this code, for some reason the run_report_object() and the report_object_status() function do not return proper values.
I checked under the report node, I have 2 nodes: RP2RRO and BTPRTINV.
1) From those 2 nodes, can I call 10 different reports ?
(Shouldn't each different report have a seperate node to be referenced ?)
Of the 10 reports to be called, 2 make reference/invoke a parameter form.
2) Are there additional settings to be made for the parameter form ?
Also, when attempting to debug my code, i noticed that the v_rep variable took the value of RepSRV_0 when I had explicitly set it to RepSRV in the source code.
3) Could this be a source of problem ?
PT
I have been working on the Forms invoking Reports over the Web part of my application.
I set the system paramters DESTYPE and DESNAME with the set_system as follows before setting variables through the parameter list:
-----
/*************************
Code modified by the Forms Migration Assistant
12-Sep-2004 03:07 PM
**************************
PROCEDURE Print_transaction IS
pl_id PARAMLIST;
repid report_object;
v_rep VARCHAR2(200);
rep_status VARCHAR2(200);
rep_url varchar2(500);
BEGIN
pl_id := Get_parameter_list('TRANSA
if not id_null(pl_id)
then destroy_parameter_list(pl_
end if;
---'repid := find_report_object('btrepp
repid := find_report_object('BTPRTI
pl_id := Create_parameter_list('TRA
set_report_object_property
set_report_object_property
set_report_object_property
set_report_object_property
--set_report_object_proper
set_report_object_property
---set_report_object_prope
--- 'P_PRINT_DATE=' || to_char(:variable.print_da
--- 'P_PROJECT=' || :variable.project ||
--- 'P_CO=' || :company.co ||
--- 'P_SURVEYOR=' || to_char(:variable.surveyor
add_parameter(pl_id,'PARAM
--add_parameter(pl_id,'DES
--add_parameter(pl_id,'DES
add_parameter(pl_id,'COPIE
----add_parameter(pl_id,'P
----add_parameter(pl_id,'P
----add_parameter(pl_id,'P
-- add_parameter(pl_id,'P_SUR
--- rp2rro.rp2rro_run_product(
message('Ok, Parameter List + Report Object Set', 1);
v_rep := run_report_object(repid, pl_id);
if v_rep is not null then
rep_status := report_object_status(v_rep
message('Report Status Loop....Wait....', 1);
while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED') loop
rep_status := report_object_status(v_rep
end loop;
message('Ok, Trying to run over the Web', 1);
if rep_status = 'FINISHED' then
-- display the report in the browser
rep_url := 'http://terrain2004:8888/reports/rwservlet/getjobid' ||
substr(v_rep, instr(v_rep, '_', -1) +1) ||
'?'||'server=RepSRV';
web.show_document(rep_url,
elsif rep_status = 'TERMINATED_WITH_ERROR' then
message('TERMINATED_WITH_E
else
message('Some other Error when running the report', 1);
end if;
else
message('Report object not valid', 1);
end if;
destroy_parameter_list(pl_
END;
=====
When I run this code, for some reason the run_report_object() and the report_object_status() function do not return proper values.
I checked under the report node, I have 2 nodes: RP2RRO and BTPRTINV.
1) From those 2 nodes, can I call 10 different reports ?
(Shouldn't each different report have a seperate node to be referenced ?)
Of the 10 reports to be called, 2 make reference/invoke a parameter form.
2) Are there additional settings to be made for the parameter form ?
Also, when attempting to debug my code, i noticed that the v_rep variable took the value of RepSRV_0 when I had explicitly set it to RepSRV in the source code.
3) Could this be a source of problem ?
PT
You can use only one report object for each report. Here is my code (it is OUR_DUMMY_REPORT):
PROCEDURE SPUSTI_REPORT IS
pl_id ParamList;
pl_name VARCHAR2(10) := 'tempdata';
report_id Report_Object;
report_job_id VARCHAR2(200);
rep_status VARCHAR2(200);
alert_button PLS_INTEGER;
al_id Alert:= Find_Alert('chyba');
vc_dummy_report Varchar2(20):='OUR_DUMMY_R EPORT';
L_REPORT ZOSTAVY.REPORT%TYPE;
L_REPORT_DESFORMAT ZOSTAVY.REPORT_DESFORMAT%T YPE;
L_REPORT_SERVER ZOSTAVY.REPORT_SERVER%TYPE ;
L_REPORT_SERVER_PATH ZOSTAVY.REPORT_SERVER_PATH %TYPE;
BEGIN
pl_id := Get_Parameter_List(pl_name );
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
pl_id := Create_Parameter_List(pl_n ame);
IF Id_Null(pl_id) THEN
Set_Alert_Property(al_id,a lert_messa ge_text,'N epodarilo sa vytvoriť súbor parametrov potrebný pre spustenie zostavy.Končím spúšťanie zostavy.' );
alert_button := Show_Alert(al_id);
RAISE Form_Trigger_Failure;
END IF;
....
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
report_id:= FIND_REPORT_OBJECT(vc_dumm y_report);
BEGIN
Select z.REPORT,z.REPORT_DESFORMA T,z.REPORT _SERVER,z. REPORT_SER VER_PATH
INTO L_REPORT,L_REPORT_DESFORMA T,L_REPORT _SERVER,L_ REPORT_SER VER_PATH FROM ZOSTAVY z WHERE z.id=:Z3_ZOSTAVY_UKAZ.ID;
EXCEPTION
WHEN NO_DATA_FOUND THEN
Set_Alert_Property(al_id,a lert_messa ge_text,'Z OSTAVU sa nepodarilo vytvoriť.');
alert_button := Show_Alert(al_id);
return;
END;
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_FI LENAME,L_R EPORT); -- report ZOZNAM_ZAKAZNIKOV
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_CO MM_MODE,SY NCHRONOUS) ;
IF Get_Application_Property(U SER_INTERF ACE)='WEB' THEN
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_EX ECUTION_MO DE,BATCH);
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_DE STYPE,CACH E);
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_DE SFORMAT,L_ REPORT_DES FORMAT); --'html'
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_SE RVER,L_REP ORT_SERVER ); --'RepBA'
report_job_id := RUN_REPORT_OBJECT(report_i d,pl_id);
rep_status:=REPORT_OBJECT_ STATUS(rep ort_job_id );
WHILE rep_status in ('RUNNING','OPENING_REPORT ','ENQUEUE D')
LOOP
rep_status := report_object_status(repor t_job_id);
END LOOP;
IF rep_status='FINISHED' THEN
Web.Show_Document(L_REPORT _SERVER_PA TH||'/dev6 0cgi/rwcgi 60.exe/get jobid='||r eport_job_ id||'?serv er='||L_RE PORT_SERVE R);
ELSE
Set_Alert_Property(al_id,a lert_messa ge_text,'Z OSTAVU sa nepodarilo vytvoriť.');
alert_button := Show_Alert(al_id);
END IF;
ELSE
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_EX ECUTION_MO DE,RUNTIME );
SET_REPORT_OBJECT_PROPERTY (report_id ,REPORT_DE STYPE,PREV IEW);
Add_Parameter(pl_id,'BLANK PAGES', TEXT_PARAMETER, 'NO');
Add_Parameter(pl_id,'MAXIM IZE', TEXT_PARAMETER, 'YES');
report_job_id := RUN_REPORT_OBJECT(report_i d,pl_id);
END IF;
END SPUSTI_REPORT;
Maybe the problem is in your report objects RP2RRO and BTPRTINV. What is the definition of these objects ?
The properties of my OUR_DUMMY_REPORT are:
Name = OUR_DUMMY_REPORT
Execution Mode = Batch
Communication Mode = Synchronous
Report Destination Type = File
PROCEDURE SPUSTI_REPORT IS
pl_id ParamList;
pl_name VARCHAR2(10) := 'tempdata';
report_id Report_Object;
report_job_id VARCHAR2(200);
rep_status VARCHAR2(200);
alert_button PLS_INTEGER;
al_id Alert:= Find_Alert('chyba');
vc_dummy_report Varchar2(20):='OUR_DUMMY_R
L_REPORT ZOSTAVY.REPORT%TYPE;
L_REPORT_DESFORMAT ZOSTAVY.REPORT_DESFORMAT%T
L_REPORT_SERVER ZOSTAVY.REPORT_SERVER%TYPE
L_REPORT_SERVER_PATH ZOSTAVY.REPORT_SERVER_PATH
BEGIN
pl_id := Get_Parameter_List(pl_name
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;
pl_id := Create_Parameter_List(pl_n
IF Id_Null(pl_id) THEN
Set_Alert_Property(al_id,a
alert_button := Show_Alert(al_id);
RAISE Form_Trigger_Failure;
END IF;
....
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
report_id:= FIND_REPORT_OBJECT(vc_dumm
BEGIN
Select z.REPORT,z.REPORT_DESFORMA
INTO L_REPORT,L_REPORT_DESFORMA
EXCEPTION
WHEN NO_DATA_FOUND THEN
Set_Alert_Property(al_id,a
alert_button := Show_Alert(al_id);
return;
END;
SET_REPORT_OBJECT_PROPERTY
SET_REPORT_OBJECT_PROPERTY
IF Get_Application_Property(U
SET_REPORT_OBJECT_PROPERTY
SET_REPORT_OBJECT_PROPERTY
SET_REPORT_OBJECT_PROPERTY
SET_REPORT_OBJECT_PROPERTY
report_job_id := RUN_REPORT_OBJECT(report_i
rep_status:=REPORT_OBJECT_
WHILE rep_status in ('RUNNING','OPENING_REPORT
LOOP
rep_status := report_object_status(repor
END LOOP;
IF rep_status='FINISHED' THEN
Web.Show_Document(L_REPORT
ELSE
Set_Alert_Property(al_id,a
alert_button := Show_Alert(al_id);
END IF;
ELSE
SET_REPORT_OBJECT_PROPERTY
SET_REPORT_OBJECT_PROPERTY
Add_Parameter(pl_id,'BLANK
Add_Parameter(pl_id,'MAXIM
report_job_id := RUN_REPORT_OBJECT(report_i
END IF;
END SPUSTI_REPORT;
Maybe the problem is in your report objects RP2RRO and BTPRTINV. What is the definition of these objects ?
The properties of my OUR_DUMMY_REPORT are:
Name = OUR_DUMMY_REPORT
Execution Mode = Batch
Communication Mode = Synchronous
Report Destination Type = File
ASKER
Hello,
In my case, I have a Parameter Form to generate with my Report. Before I generate my report I have to display a Parameter form. This involves defining 3 extra user parameters in my Report: P_ACTION, P_USER_CONNECT and P_SERVERNAME.
With each report I also have about 4 or 5 user parameters to pass.
1) Do you have a good example of this ?
I understand from the oracle documentation that I have to modify my code on the Forms side and then on the Reports side. On the report side, I have to enter some code to generate the HTML ACTION attibute in the BEFORE PARAMETER FORM trigger.
2) Your toughts ....
PT
In my case, I have a Parameter Form to generate with my Report. Before I generate my report I have to display a Parameter form. This involves defining 3 extra user parameters in my Report: P_ACTION, P_USER_CONNECT and P_SERVERNAME.
With each report I also have about 4 or 5 user parameters to pass.
1) Do you have a good example of this ?
I understand from the oracle documentation that I have to modify my code on the Forms side and then on the Reports side. On the report side, I have to enter some code to generate the HTML ACTION attibute in the BEFORE PARAMETER FORM trigger.
2) Your toughts ....
PT
I have no experiences with generating the HTML ACTION attibute, so I cannot advice.
ASKER
Hello,
Any idea where I could get some more information about this ?
PT
Any idea where I could get some more information about this ?
PT
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
v_rep := run_report_object(repid,pl
instead of
v_rep := run_report_object(repid);
You can also increase v_rep and rep_status to VARCHAR2(200);