Home » Developer & Programmer » Forms » calling report from forms
calling report from forms [message #289171] Wed, 19 December 2007 23:32 Go to next message
fiery_hanzy
Messages: 10
Registered: December 2007
Junior Member
hello evry1,
i'm trying to integrate reports with forms. i have attached the sample reports in the report tab given in forms. now in the layout i have created a button.
what i want is that by pressing that button i want to see the report ouput in html/pdf/etc..
the code i have written in when-button-pressed trigger is given below:
***************************************************************
DECLARE
report_id REPORT_OBJECT;
report_job_id VARCHAR2(200);
rep_status VARCHAR2(200);
JOB_NUMBER NUMBER;
server_name VARCHAR2(200) := '<report_server_name>';

BEGIN

/* Check to see if forms application is WEB deployed */

IF get_application_property(user_interface) = 'WEB' THEN
report_id := FIND_REPORT_OBJECT('FORM_REP');

/* Set Report parameters given WEB deployment */
SET_REPORT_OBJECT_PROPERTY(report_id,
REPORT_SERVER,
server_name);
SET_REPORT_OBJECT_PROPERTY(report_id,
REPORT_DESTYPE,
FILE);

/* DESFORMAT could be HTML, HTMLCSS or PDF here*/
SET_REPORT_OBJECT_PROPERTY(report_id,
REPORT_DESFORMAT,
'PDF');

/* 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) + 1;
WEB.SHOW_DOCUMENT('http://tcssunserver1.tcscal.co.in:8060/' ||
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('FORM_REP');
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;
****************************************************************
my question is what i should write there in <report_server_name>(c in bold letters). becuase i am gettin the error:
FRM-41213: unable to connect to the report server:<report_server_name>

please help me out...what should i write in report_server_name?
Re: calling report from forms [message #289182 is a reply to message #289171] Thu, 20 December 2007 00:18 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
So close and yet so far. Look at http://www.orafaq.com/forum/m/144539/67467/?srch=web.show_document#msg_144539

Your report server is not running. The 'web.show_document' will start it for you, 'run_report_object' will not.

David
Re: calling report from forms [message #289211 is a reply to message #289171] Thu, 20 December 2007 04:23 Go to previous messageGo to next message
fiery_hanzy
Messages: 10
Registered: December 2007
Junior Member
hi David,
thanks for ur reply...but am gettin the error that
Authentication Failed.
can u please write the code? using this:
report name: abc.rdf
form name: xyz.fmb
am using reports 6i n forms 6i.
Re: calling report from forms [message #289345 is a reply to message #289211] Thu, 20 December 2007 19:47 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Something as simple as
DECLARE
   v_show_document       VARCHAR2 (2000) := '/reports/rwservlet?';
   v_connect             VARCHAR2 (30)   := 'connectionName';
   v_report_server       VARCHAR2 (30)   := 'repserver90';
BEGIN
   v_show_document := v_show_document
      || v_connect
      -- Report server
      || '&server='
      || v_report_server
      -- Report name
      || '&report=abc'
      -- Reports parameters
      || '&destype=CACHE'
      || '&desformat=PDF';
   web.show_document (v_show_document);
END;
should be able to do the job.

Have you run a report from the report builder yet?

David
Previous Topic: Default format of sysdate in forms 6i
Next Topic: Displaying message on the screen of a client
Goto Forum:
  


Current Time: Sun Dec 11 04:22:49 CST 2016

Total time taken to generate the page: 0.05645 seconds