Run_Product(REPORTS,'c\:rk.rep',SYNCHRONOUS,RUNTIME,FILEsYSTEM, 参数,null)

解决方案 »

  1.   

    我把form的帮助文档发给你,里面有个例子。语法:
    PROCEDURE RUN_PRODUCT
      (product   NUMBER, 
       module  VARCHAR2, 
       commmode  NUMBER, 
       execmode  NUMBER, 
       location  NUMBER,
       paramlist_id      VARCHAR2, 
       display   VARCHAR2); 
    PROCEDURE RUN_PRODUCT
      (product   NUMBER, 
       module  VARCHAR2, 
       commmode  NUMBER, 
       execmode  NUMBER, 
       location  NUMBER,
       paramlist_name      VARCHAR2, 
       display   VARCHAR2); Built-in Type  unrestricted procedure 
    Enter Query Mode  yes Parametersproduct Specifies a numeric constant for the Oracle product you want to invoke: FORMS specifies a Runform session. GRAPHICS specifies Graphics Builder.  REPORTS specifies Report Builder. BOOK specifies Oracle Book.
    module Specifies the VARCHAR2 name of the module or module to be executed by the called product.  Valid values are the name of a form module, report, Graphics Builder display, or Oracle Book module.  The application looks for the module or module in the default paths defined for the called product. commmode Specifies the communication mode to be used when running the called product.  Valid numeric constants for this parameter are SYNCHRONOUS and ASYNCHRONOUS. SYNCHRONOUS specifies that control returns to Form Builder only after the called product has been exited.  The end user cannot work in the form while the called product is running. 
    ASYNCHRONOUS specifies that control returns to the calling application immediately, even if the called application has not completed its display. execmode Specifies the execution mode to be used when running the called product.  Valid numeric constants for this parameter are BATCH and RUNTIME.  When you run Report Builder and Graphics Builder, execmode can be either BATCH or RUNTIME.  When you run Form Builder, always set execmode to RUNTIME. location Specifies the location of the module or module you want the called product to execute, either the file system or the database.  Valid constants for this property are FILESYSTEM and DB. Paramlist_name or paramlist_ID Specifies the parameter list to be passed to the called product.  Valid values for this parameter are the VARCHAR2 name of the parameter list, the ID of the parameter list, or a null string ('').  To specify a parameter list ID, use a variable of type PARAMLIST. You can pass text parameters to called products in both SYNCHRONOUS and ASYNCHRONOUS mode. However, parameter lists that contain parameters of type DATA_PARAMETER (pointers to record groups) can only be passed to Report Builder and Graphics Builder in SYNCHRONOUS mode.  (SYNCHRONOUS mode is required when invoking Graphics Builder to return an Graphics Builder display that will be displayed in a form chart item.)
    Note: You can prevent Graphics Builder from logging on by passing a parameter list that includes a parameter with key set to LOGON and value set to NO. Note:  You cannot pass a DATA_PARAMETER to a child query in Report Builder. Data passing is supported only for master queries. display Specifies the VARCHAR2 name of the Form Builder chart item that will contain the display (such as a pie chart, bar chart, or graph) generated by Graphics Builder.  The name of the chart item must be specified in the format block_name.item_name. (This parameter is only required when you are using an Graphics Builder chart item in a form.)
    例子:
    /* ** Built-in:  RUN_PRODUCT 
    ** Example:   Call a Report Builder report, passing the 
    **            data in record group 'EMP_RECS' to substitute 
    **            for the report's query named 'EMP_QUERY'. 
    **            Presumes the Emp_Recs record group already 
    **            exists and has the same column/data type 
    **            structure as the report's Emp_Query query. 
    */ 
    PROCEDURE Run_Emp_Report IS 
      pl_id ParamList; 
    BEGIN 
      /* 
      ** Check to see if the 'tmpdata' parameter list exists. 
      */ 
      pl_id := Get_Parameter_List('tmpdata'); 
      /* 
      ** If it does, then delete it before we create it again in 
      ** case it contains parameters that are not useful for our 
      ** purposes here. 
      */ 
      IF NOT Id_Null(pl_id) THEN 
        Destroy_Parameter_List( pl_id ); 
      END IF; 
      /* 
      ** Create the 'tmpdata' parameter list afresh. 
      */ 
      pl_id := Create_Parameter_List('tmpdata'); 
      /* 
      ** Add a data parameter to this parameter list that will 
      ** establish the relationship between the named query 
      ** 'EMP_QUERY' in the report, and the record group named 
      ** 'EMP_RECS' in the form. 
      */ 
      Add_Parameter(pl_id,'EMP_QUERY',DATA_PARAMETER,'EMP_RECS'); 
      /*
      **Pass a Parameter into PARAMFORM so that a parameter dialog will not appear
      **for the parameters being passing in.
      */  Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
      /* 
      ** Run the report synchronously, passing the parameter list
      */ 
      Run_Product(REPORTS, 'empreport', SYNCHRONOUS, RUNTIME, 
               FILESYSTEM, pl_id, NULL); 
    END;
      

  2.   

    首先在程序单元中添加 
    procedure run_report_object_proc(vc_reportname varchar2, vc_runformat varchar2, 
    vc_param varchar2) IS 
        report_id  Report_Object; 
        report_job_id   VARCHAR2(200); 
        rep_status       VARCHAR2(200);    
        JOB_NUMBER number;   
        v_server_length number; 
    begin 
        report_id:= FIND_REPORT_OBJECT(vc_reportname); 
        v_server_length:=Length(GET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER)); 
        set_report_object_property(report_id, REPORT_EXECUTION_MODE, BATCH); 
        set_report_object_property(report_id, REPORT_COMM_MODE, SYNCHRONOUS); 
        set_report_object_property(report_id, REPORT_DESTYPE, CACHE); 
        set_report_object_property(report_id, REPORT_DESFORMAT, vc_runformat); 
    --    set_report_object_property(report_id, REPORT_SERVER, vc_reportserver); 
         
        SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER, 
                                  'paramform=no PAGESTREAM=YES '||vc_param); 
        report_job_id := RUN_REPORT_OBJECT(report_id); 
        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 
         JOB_NUMBER := length('RepUltra') + 2; 
          Web.show_document('/reports/rwservlet/getjobid'|| 
          substr(report_job_id, v_server_length+2)||'?server=repultra.local','_blank'); 
          
          
          ELSE 
          message ('Report failed with error message '||rep_status); 
        END IF; 
    end; 
    然后再form的报表中将你做好的report调用近来,注意,要不报表服务器名称写上不要报表的绝对路径只要报表的名称。 
    在在print按钮中添加 
    Run_Report_Object_Proc('form中添加生成的报表名称','PDF/html','p_sdate="'||block中队赢得项||'"'); 
    这样就可以了