1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| DECLARE
report_id REPORT_OBJECT;
report_job_id VARCHAR2(200);
rep_status VARCHAR2(200);
JOB_NUMBER number;
server_name VARCHAR2(200) := 'credits';
BEGIN
/* Check to see if forms application is WEB deployed */
IF get_application_property(user_interface) = 'WEB' THEN
report_id:= FIND_REPORT_OBJECT('TEST');
/* Set Report parameters given WEB deployment */
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');
/* Run the report */
report_job_id := RUN_REPORT_OBJECT(report_id);
/* 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' THEN
message('REPORT WAS CORRECTLY RUN');
/* Display the report output in the client browser */
JOB_NUMBER := length(server_name) + 2;
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;
ELSE
/* Else if forms application is Client-Server deployed */
/* Set Report parameters given Client-Server deployment */
report_id:= FIND_REPORT_OBJECT('TEST');
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER ,'');
/* Report to be executed via Reports Background Engine, not the 'new' Reports Multi-Tier Server */
/* Destype SCREEN or PREVIEW can be used here */
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE,SCREEN);
/* Run the report */
report_job_id := RUN_REPORT_OBJECT(report_id);
END IF;
END; |
Partager