You are on page 1of 1

How to call reports using oracle forms 10g developer.

Well I am sure this example will help you to create your production level forms and reports. This is the simple example using the demo user of oracle scott having table emp. Create a simple report based on table EMP with a user parameter: select * from emp where deptno = :department; Now Compile and save the report C:\TEST\FORMS10G\EMP.RDF. Please check your repo rt is working fine and also taking the forms input from your parameter. You can view the output in run preview. Then Create a simple form and drag a button to call report using the procedure a nd text item name=department. Go to Command Prompt and write this down. rwserver server=reportserver10g Now Open Property Palette for Reports object in the Forms Object Navigator and e nter the following: Name: EMP Filename: C:\TEST\FORMS10G\EMP.RDF Note: Please note that you must specify full path to your RDF file or add this p ath into REPORTS_PATH environment variable. Report Destination Type: CACHE Report Destination Format: HTML Report Server: reportserver10g (This is the same server name as you had define for your report server on comman d prompt) On button Create a WHEN-BUTTON-PRESSED trigger with the following code: Name = test_report Now write the code in the area of code: PROCEDURE TEST_REPORT IS repid REPORT_OBJECT; v_rep VARCHAR2(100); rep_status VARCHAR2(20); BEGIN repid := find_report_object('emp'); SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH); SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS); SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE); SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'html'); -- PDF, HTMLCSS ... SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'reportserver10g'); SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no pdeptno='||:depart ment); 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 WEB.SHOW_DOCUMENT('http://<YourServerName:your _port/reports/rwservlet/getjobid'|| substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=reportserver10g','_blank'); /*the above code will help you to create in browser*/ ELSE message('Error in report'); END IF; END; Now simply compile the form. And Run the form enter the department and then click the button. Report will be displayed in a new browser window if you have mention the html format or else an acrobat reader will run and will show the report.

You might also like