Monday, July 6, 2015


 Calling Oracle Report 10g 



     In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,

Oracle Reports is a tool for developing reports against data stored in an Oracle database. Oracle Reports consists of Oracle Reports Developer (a component of the Oracle   Developer Suite) and Oracle Application Server Reports Services
 (a component of the Oracle Application Server )


 :Key Task 

       Calling a report from a parameter form.

 Five Steps To Call a Report:  
  1. Create a parameter form; click new form module.
  2. Create a non database block with the following input text item e.g. date_from and date_to with a format mask the same as the report date parameter.
  3. Create a report node with the report name.
  4. Invoke the report node property fill Filename Property with the report name, select  run_time for the Execution Mode Properties, select synchronize for the Execution Mode Properties.
  5. Create a program unit e.g. run_report procedure paste the code and do the necessary changes required according to you own report and server report name.


PROCEDURE run_report IS

    v_report_id                REPORT_OBJECT;
    vc_report_job_id        VARCHAR2(100); -- Unique ID for each report.
    vc_rep_status            VARCHAR2(100);  -- The report job status 
--You have to change the next report server name initialized between
--two single quotes according to your report server name
v_report_server          VARCHAR2 (30) := 'report_server_ora';
BEGIN
  /* The next three code lines point to the report object previously created in form's report object node */
 v_report_id  := FIND_REPORT_OBJECT('your_report_name');

  SET_REPORT_OBJECT_PROPERTY(v_report_id ,REPORT_COMM_MODE,SYNCHRONOUS);
  SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,CACHE);
/* Set the report output format; choose one and only one format out of the following options e.g. 'PDF' or ''HTML' etc. */
 SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT,  'HTML|
HTMLCSS|PDF|RTF|XML|DELIMITED'); 
 /* Replace the report server name with the name of the Reports
Services defined in your tnsnames.ora file*/
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_SERVER,'v_report_server');
/* Define different user parameters; global, parameter form and date to be passed to the report.
Note: All parameters MUST be character datatype */
/* The Report's Parameter form is suppressed by setting param form parameter to 'NO'.*/
 SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER, 'paramform=no'
                                              ||' P_USER_ID='||:GLOBAL.USER_ID                       
||' P_SECTOR_ID='|| :PARAMETER.PARAMETER_SECTOR                                           
||' P_FROM_DATE='|| TO_CHAR( :FROM_DATE,'DD-MM-RRRR')
                                             ||'P_TO_DATE='||TO_CHAR(:TO_DATE,'DD-MM-RRRR');
 /* Finally, run the report and retrieve the report job id as a handle to the report process*/
vc_report_job_id := RUN_REPORT_OBJECT(v_report_id);
/*Display the report in the browser in a separate browser you follow*/
web.show_document ('///getjobid='||
 vc_report_job_id ||'?server='|| '','_blank');
/*Sample Example valid to a report server on the same pc or vm not a remote one. */
WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||
SUBSTR (vc_report_job_id,instr(vc_report_job_id,'_',-1)+1)||'?','_blank');
ELSE
       MESSAGE (' Report Status is : ' || vc_rep_status );
PAUSE;
END IF;
END;
  
Note  
           To access a Remote Reports Server on a different machine:
 you must use the following prefix   http://hostname:port/... 
 You can NOT use REPORT_FILENAME or REPORT_DESNAME with (CACHE) 
When Calling the Report output to be displayed in a separate browser window.
 
Learn more about:


Hope this helps…

My success only comes from Allah, pls. note your comments and suggestions are great 
help for me in progress thanks in advance.