Oracle FormsでのReportsの表示
Oracle FormsでReportsを表示するために実行する必要があるステップ。
フォームにOracle Reportsアプリケーションが埋め込まれている場合、そのフォームをOracle Formsにアップグレードするには、Reports 9iへの統合されたコールを、次のビルトインを使用するように変更します。
-
RUN_REPORT_OBJECTビルトイン(RUN_PRODUCTビルトインを使用してReportsをコールしないでください)
-
WEB.SHOW_DOCUMENTビルトイン
統合されたReports 9iをOracle FormsのRUN_PRODUCTを使用して実行する方法は、このリリースではサポートされません。12c以降では、このビルトインを使用するとコンパイル・エラーが発生します。RUN_REPORT_OBJECTを使用するようにアプリケーションをアップグレードするためのツールとして、Migration Assistantが提供されています。「Oracle Forms Migration Assistantの使用について」を参照してください。
次の例では、RUN_REPORT_OBJECTビルトインを使用してレポートを実行します。ここでは、Oracle Formsに定義されているreport_objectノードを"report_node1"と仮定します。ユーザー定義のReportsパラメータ"p_deptno"が、"dept.deptno"フィールドの値を使用してFormsから渡されます。Reportsパラメータ・フォームは抑止されます。この例で使用するロジックの追加の詳細も提供されます
DECLARE v_report_id Report_Object; vc_report_job_id VARCHAR2(100); /* unique id for each Report request */ vc_rep_status VARCHAR2(100); /* status of the Report job */ BEGIN /* Get a handle to the Report Object itself. */ v_report_id:= FIND_REPORT_OBJECT('report_node1'); SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_COMM_MODE, SYNCHRONOUS); SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,CACHE); /* Define the Report output format and the name of the Reports Server as well as a user-defined parameter, passing the department number from Forms to the Report. The Reports parameter form is suppressed by setting paramform to "no". */ SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT, '<HTML|HTMLCSS|PDF|RTF|XML|DELIMITED>'); /* replace <ReportServerTnsName> with the name of the Reports Services as defined in your tnsnames.ora file */ SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_SERVER, '<ReportServerTnsName>'); SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER, 'p_deptno='||:dept.deptno||'paramform=no'); /* finally, run the report and retrieve the Reports job_id as a handle to the Reports process */ vc_report_job_id:=RUN_REPORT_OBJECT(report_id); /*The report output is not delivered automatically to the client, which is okay because the Web is a request model. Thus the next step is to check if the report finished. */ vc_rep_status := REPORT_OBJECT_STATUS(vc_report_job_id); IF vc_rep_status='FINISHED' THEN /* Call the Report output to be displayed in a separate browser window. The URL for relative addressing is only valid when the Reports Server is on the same host as the Forms Server. For accessing a Remote Reports Server on a different machine, you must use the prefix http://hostname:port/ */ web.show_document ('/<virtual path>/<reports cgi or servlet name>/getjobid='|| vc_report_job_id ||'?server='|| '<ReportServerTnsName>','_blank'); ELSE message ('Report failed with error message '||rep_status); END IF; END;
例: 追加の詳細
-
レポートを同期式でコールすると、サーバーでレポートが処理されている間、待機する必要があります。長時間実行するReportsでは、REPORT_COMM_MODEプロパティを非同期に設定し、REPORT_EXECUTION_MODEをバッチに設定して、レポートを非同期式で開始することをお薦めします。
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE,BATCH);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE,ASYNCHRONOUS);
-
RUN_REPORT_OBJECTビルトインをコールした後に、タイマーを作成し、When-Timer-Expiredトリガーを使用して現在のREPORT_OBJECT_STATUSを頻繁にチェックする必要があります。パフォーマンス上の理由により、このタイマーは1分間に5回以上実行しないでください。レポートが生成された後、When-Timer-ExpiredトリガーによってWEB.SHOW_DOCUMENTビルトインがコールされ、一意のjob_idで識別されるReports出力ファイルがクライアントのブラウザにロードされます。
ノート:
タイマーは、不要になったら必ず削除してください。
次の例は、Report_Object_StatusをチェックするWhen-Timer-Expiredトリガーを示しています。
(...) /* :global.vc_report_job_id needs to be global because the information about the Report job_id is shared between the trigger code that starts the Report and the When-Trigger-Expired trigger that checks the current Report status. */ vc_rep_status:= REPORT_OBJECT_STATUS(:global.vc_report_job_id); IF vc_rep_status='FINISHED' THEN web.show_document ('/<virtual path>/<reports cgi or servlet name>/getjobid='|| vc_report_job_id ||'?server='|| '<ReportServerTnsName>','_blank'); ELSIF vc_rep_status not in ('RUNNING','OPENING_REPORT','ENQUEUED') THEN message (vc_rep_status||' Report output aborted'); END IF; (...)