Press "Enter" to skip to content

Calling / Running a report in Oracle forms 10g / 11g

Calling / Running a report in Oracle forms 10g / 11g

Below is the procedure to call a report in Oracle Forms 10g/11g  by passing report file name with full path and report format like ‘PDF’, ‘RTF’ etc.

Procedure call_report (preport In Varchar2, pformat In Varchar2)
Is
      pi_id                paramlist;
      repno                Number;
      al_id                alert;
      al_report            Number;
      User                 Varchar2 (25);
      pass                 Varchar2 (25);
      today                Date;
      store_var            Varchar2 (150);
      –OC
      vc_reportserverjob   Varchar2 (100);
      report_job_id        Varchar2 (100);
      repid                report_object;
      v_rep_status         Varchar2 (100);
   Begin
      pi_id := Get_parameter_list (‘rep_param’);

      If Not Id_null (pi_id)
      Then
         Destroy_parameter_list (pi_id);
      End If;

      pi_id := Create_parameter_list (‘rep_param’);

      Add_parameter (pi_id,
                     ‘PARAMFORM’,
                     TEXT_PARAMETER,
                     ‘no’);
      — report object
      — the below report object ‘cproreport’ must be created in Report object navigator.

      repid := Find_report_object (‘cproreport’);

      Set_report_object_property (repid, report_filename, Rtrim(:parameter.report_path)||preport);
      Set_report_object_property (repid, report_server, :parameter.r_server);
      Set_report_object_property (repid, report_execution_mode, RUNTIME);
      Set_report_object_property (repid, report_comm_mode, SYNCHRONOUS);
      Set_report_object_property (repid, report_destype, cache);
      Set_report_object_property (repid, report_desformat, pformat);

      vc_reportserverjob := Run_report_object (repid, pi_id);
      report_job_id :=
         Substr (vc_reportserverjob,
                 Length (:parameter.r_server) + 2,
                 Length (vc_reportserverjob));
      v_rep_status := Report_object_status (vc_reportserverjob);

      If v_rep_status = ‘FINISHED’
      Then
         web.show_document (
               ‘http://’
            || :parameter.host
            || ‘:’
            || :parameter.port
            || ‘/reports/rwservlet/getjobid’
            || report_job_id
            || ‘?server=’
            || :parameter.r_server,
            ‘_blank’
         );
      Else
         Message (‘error when running report’ || v_rep_status);
      End If;
   End;

Vinish Kapoor

FoxInfotech.in is created, written, and maintained by Vinish Kapoor. It is built on WordPress, and hosted by Bluehost. Connect with Vinish on Facebook, Twitter, and GitHub.

You may also like:

One Comment

Comments are closed.