- Name: REPORT_DUMMY o el que uno elija, para invocarlo en el código
- Filename: WGDUMMY.rdf, o test.rdf, o algún reporte creado o nuevo
- Execution mode: BATCH
- Communication mode: SYNCHRONOUS
- Data source data block: NULL
- Report destination type: CACHE
- Report destination format: HTMLCSS
- Report server: REPSRVR
report_id REPORT_OBJECT;
JOB_NUMBER number;
report_job_id VARCHAR2(200);
rep_status VARCHAR2(200);
server_name VARCHAR2(200) := 'repSRVR';
reports_server VARCHAR2(50) := 'http://172.16.0.116:7777/reports/rwservlet?';
filename VARCHAR2(50) := upper(repname)||'.rdf';
user_name VARCHAR2(50);
user_password VARCHAR2(50);
user_connect VARCHAR2(50) := 'dbdesa';
connect_string VARCHAR2(100);
BEGIN
report_id:= FIND_REPORT_OBJECT('REPORT_DUMM');
/* para que tome el usuario y la conexion automaticamente */
user_name := get_application_property(USERNAME);
user_password := get_application_property(PASSWORD);
/* Sirve para SQL*NET
user_connect := get_application_property(CONNECT_STRING); */
connect_string := user_name||'/'||user_password||'@'||user_connect;
/* Set Report parameters given WEB deployment */
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER, server_name);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, CACHE);
/* DESFORMAT could be HTML, HTMLCSS or PDF here*/
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,'HTML');
/* FILENAME could be repname */
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME,filename);
/* Cada parametro debe ir separado por espacio, aun el paramform */
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,'P_ACTION='||reports_server||' paramform=yes P_USER_CONNECT='||connect_string||' P_SERVERNAME='||server_name);
/* Run the report */
report_job_id := RUN_REPORT_OBJECT(report_id, SERVER_NAME);
/* Check the report status */
rep_status:=REPORT_OBJECT_STATUS(report_job_id);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(report_job_id);
END LOOP;
IF rep_status='FINISHED' or rep_status is NULL THEN
message('REPORT WAS CORRECTLY RUN');
/* Display the report output in the client browser */
JOB_NUMBER := length(server_name) + 2;
--WEB.SHOW_DOCUMENT ('http://mymachine.mydomain:portno/dev60cgi/rwcgi60.exe/getjobid='||substr(report_job_id,JOB_NUMBER)||'?se rver=' || server_name ,'_BLANK');
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'||substr(report_job_id,JOB_NUMBER)||'?server=' || server_name ,'_blank');
/* If report has failed display message to user */
ELSE
message('REPORT FAILED WITH STATUS: '||rep_status);
END IF;
END;
También hay una parte para cambiar en el reporte, tomado de 277282.pdf. Hay que agregar en cada reporte:
- En el nodo: Modelo de datos > parámetros de usuario:
- P_ACTION: Tipo de dato: Character, Ancho: 200 y Valor inicial: _action_
- P_SERVERNAME: Tipo de dato: Character, Ancho: 40
- P_USER_CONNECT: Tipo de dato: Character, Ancho: 200
- Los anteriores parámetros deben ser registrados en el menú: Herramientas > Creador de pantallas de parámetros
- En el nodo Disparadores de informes > Before Parameter Form, agregar este código:
function BeforePForm return boolean is
vc_parameter_form varchar2(4000);
vc_hidden_runtime_values varchar2(1000);
vc_report_name varchar2(100);
begin
/* If Reports is called from the URL and not from Forms then p_action is
set to its default value. In this case the hidden_value has to keep the
default value too. */
If (:p_action='_action_') then
vc_hidden_runtime_values:='_hidden_';
else
/* The Report is started from Run_Report_Object and the hidden parameter
has to be set. */
/* get the report module name */
srw.get_report_name(vc_report_name);
/* Trim off blanks up to the length that it has in characters*/
--vc_report_name:=substr(vc_report_name,1,instr(vc_report_name,' ')-1);
/* Note the only custom defined defined parameters are :p_action,:p_user_connect,
:p_servername. If there are additional parameters used for your Report
that are being passed from the form that need to be hidden,
these need to be added to the "vc_hidden_runtime_values" string */
vc_hidden_runtime_values:='report='||upper(vc_report_name)||'.rdf&destype='||:destype||'&desformat='
||:desformat||'&userid='||:p_user_connect||'&server='||:p_servername;
end if;
--INICIO: hay un comentario oculto en el html, porque Blogger no permite codigo html.
-- FIN del comentario. Revisar el código fuente.
/* set the modified before form value, overwriting the default.
/* If you want to change the look of the parameter form then you
/* can do this here as well
*/
srw.set_before_form_html (srw.text_escape, vc_parameter_form);
return (TRUE);
end;
vc_parameter_form varchar2(4000);
vc_hidden_runtime_values varchar2(1000);
vc_report_name varchar2(100);
begin
/* If Reports is called from the URL and not from Forms then p_action is
set to its default value. In this case the hidden_value has to keep the
default value too. */
If (:p_action='_action_') then
vc_hidden_runtime_values:='_hidden_';
else
/* The Report is started from Run_Report_Object and the hidden parameter
has to be set. */
/* get the report module name */
srw.get_report_name(vc_report_name);
/* Trim off blanks up to the length that it has in characters*/
--vc_report_name:=substr(vc_report_name,1,instr(vc_report_name,' ')-1);
/* Note the only custom defined defined parameters are :p_action,:p_user_connect,
:p_servername. If there are additional parameters used for your Report
that are being passed from the form that need to be hidden,
these need to be added to the "vc_hidden_runtime_values" string */
vc_hidden_runtime_values:='report='||upper(vc_report_name)||'.rdf&destype='||:destype||'&desformat='
||:desformat||'&userid='||:p_user_connect||'&server='||:p_servername;
end if;
--INICIO: hay un comentario oculto en el html, porque Blogger no permite codigo html.
-- FIN del comentario. Revisar el código fuente.
/* set the modified before form value, overwriting the default.
/* If you want to change the look of the parameter form then you
/* can do this here as well
*/
srw.set_before_form_html (srw.text_escape, vc_parameter_form);
return (TRUE);
end;
2 comentarios:
Hola, tu sabes como lanzar el reporte usando web.show_document??
Publicar un comentario