8 Replies Latest reply: Mar 22, 2013 4:59 AM by HamidHelal RSS

    How to Check the report is Finished while calling a report from Forms 6i

    user3029023
      Dear All,

      I am Calling a report from oracle forms 6i, after runing report in " Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);"
      I need to copy the pdf to store it in another place once the report is generated.

      My Problem is : that i want ot Check first the report has generated after " Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);" is executed ? How to check the report is generated ot not?


      As i tried to use the below procedure after "Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);"" but his does not work... nothing happens

      {code}


      PROCEDURE FPC_COPY_REPORT (p_report_name varchar2) IS

           repid REPORT_OBJECT;
           v_rep VARCHAR2(100);
           rep_status varchar2(20);
           lv_id varchar2(1000);
      BEGIN
           
      repid := find_report_object('AMTP_995.RDF');
           
           
      v_rep := RUN_REPORT_OBJECT(repid);
                
      rep_status := REPORT_OBJECT_STATUS(v_rep);
           
           if rep_status = 'FINISHED' then
           
           message('Report Completed'); message('Report Completed');

           
           else
                message('Error when running report.');           message('Error when running report.');
           end if;
      END;
      {code}



      Any Help
        • 1. Re: How to Check the report is Finished while calling a report from Forms 6i
          HamidHelal
          try this..
          DECLARE
               repid REPORT_OBJECT;
               v_rep VARCHAR2(100);
               rep_status varchar2(20);
          BEGIN
          /* REP_OBJ= REPORT OBJECT CREATED UNDER REPORT NODE AT FORM */
               repid := find_report_object('REP_OBJ'); 
               v_rep := RUN_REPORT_OBJECT(repid);
               rep_status := REPORT_OBJECT_STATUS(v_rep);
               
               if rep_status = 'FINISHED' then
                    message('Report Completed');
                    message('Report Completed');
                    copy_report_object_output(v_rep,'c:\local.pdf');
                    host('netscape c:\tlocal.pdf');
               else
                    message('Error when running report.');
                    message('Error when running report.');
               end if;
          END;
          Hope this works...

          Hamid

          Mark correct/helpful to help others to get right answer(s).*

          Edited by: HamidHelal on Mar 21, 2013 10:41 AM

          Edited by: HamidHelal on Mar 21, 2013 11:52 AM {i'm testing after test i will post }
          • 2. Re: How to Check the report is Finished while calling a report from Forms 6i
            user3029023
            Thank For The Reply:


            I try this.. I put the code after " Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);

            but still this did not work....
            • 3. Re: How to Check the report is Finished while calling a report from Forms 6i
              HamidHelal
              user3029023 wrote:
              Thank For The Reply:


              I try this.. I put the code after " Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);
              no, Both are not work together. comment the run_product. or try from a simple form and button.
              {code}
              DECLARE
                   repid REPORT_OBJECT;
                   v_rep VARCHAR2(100);
                   rep_status varchar2(20);
              BEGIN
                   repid := find_report_object('REPORT7');

                   SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,'E:\Reports\OWNER_LIST.REP');

                   SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'PDF');
                   
                   v_rep := RUN_REPORT_OBJECT(repid);

                   rep_status := REPORT_OBJECT_STATUS(v_rep);
              message('value= '||v_rep);     
              message('value= '||v_rep);     
                   if rep_status = 'FINISHED' then
                        message('Report Completed');
                        message('Report Completed');
                        copy_report_object_output(v_rep,'c:\local.pdf');
                        host('netscape c:\local.pdf');
                   else
                        message('Error when running report.');
                        message('Error when running report.');
                   end if;
              END;
              {code}

              let me know the out put.

              Hamid
              • 4. Re: How to Check the report is Finished while calling a report from Forms 6i
                user3029023
                actually My code is this:

                declare
                     ln_alert          number;
                     pl_id               ParamList;
                     lv_report_name varchar2(10000);
                     lv_path  varchar2 (100) := 'C:\';
                
                     lv_shared_path  varchar2(1000); 
                     lv_copy_file varchar2(10000); 
                
                  cursor cr_dir_path IS
                  select v_dir_path
                  from md_directory
                  where v_dir_code ='SHR';
                  
                  lv_file_name varchar2(1000);
                  
                BEGIN
                  open cr_dir_path;
                  fetch cr_dir_path into lv_shared_path;
                  close cr_dir_path;
                
                
                
                lv_report_name :=  lv_path||:fn_cntl.nb_ref_no||'_M08600000_'||to_char(sysdate,'YYYYMMDD-HHmmss')||'.pdf';
                
                
                  if ffn_check_fields  THEN
                       
                     pl_id := Get_Parameter_List('LAI');
                         IF NOT Id_Null(pl_id) THEN
                              Destroy_Parameter_List( pl_id ); 
                           END IF;             
                          pl_id := Create_Parameter_List('LAI');
                
                       if :fn_cntl.nb_report_name ='MMAT_REPORT'
                            then
                                 
                                 if :fn_cntl.nb_report_desc ='EXPORT'
                                      then
                            
                                     Add_Parameter(pl_id, 'PARAMFORM',TEXT_PARAMETER, 'NO');
                         Add_Parameter(pl_id, 'DESTYPE',  TEXT_PARAMETER,'File');
                        Add_Parameter(pl_id, 'DESNAME',  TEXT_PARAMETER, lv_report_name); 
                        Add_Parameter(pl_id, 'DESFORMAT',TEXT_PARAMETER,'PDF');
                        Add_Parameter(pl_id, 'p_mat_no',TEXT_PARAMETER, :fn_cntl.nb_mat_no);    
                        Add_Parameter(pl_id, 'p_ref_no',     TEXT_PARAMETER, :fn_cntl.nb_ref_no);
                        Add_Parameter(pl_id, 'p_verified_by',TEXT_PARAMETER, user);
                                                   
                                 Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);
                                        
                      DECLARE     
                     
                           repid REPORT_OBJECT;     v_rep VARCHAR2(100);     rep_status varchar2(20);BEGIN
                                     /* REP_OBJ= REPORT OBJECT CREATED UNDER REPORT NODE AT FORM */
                         repid := find_report_object('MMAT_REPORT');      v_rep := RUN_REPORT_OBJECT(repid);
                        
                                    rep_status := REPORT_OBJECT_STATUS(v_rep);          
                      if rep_status = 'FINISHED' then
                          message('Report Completed');          message('Report Completed');
                         --copy_report_object_output(v_rep,'c:\local.pdf');
                         -- host('netscape c:\tlocal.pdf');     
                     else          message('Error when running report.');
                                                      message('Error when running report.');     
                     end if;
                             END;
                     end if;
                  end if;
                  
                   
                    
                       if :fn_cntl.nb_report_desc ='EXPORT'
                            then
                              
                              error_handler('This report will be Storde in ' ||lv_report_name||' and '||lv_shared_path|| ' Location',3); 
                                 
                                 lv_copy_file :='copy '||' "'||lv_report_name||'" "'||lv_shared_path||'"';
                                  host(lv_copy_file,no_screen);
                               error_handler('Report Has been Generated Sucessfully.',3); 
                       end if;
                       
                    end if;
                END;
                I will try first the another solution you have replied perviously... and will let you no the results... thanks a lot...
                • 5. Re: How to Check the report is Finished while calling a report from Forms 6i
                  GregorM
                  Hi.

                  As far as I can conclude from your writing, you are using client/server mode (not web). If that is true REPORT_OBJECT_STATUS will not help. What you should do is to write a custom code to connect to Oracle Report queue (I believe Oracle ships also with graphical application called rwrqm60.exe and you can fint it in ORACLE_HOME\bin direcory). There you can check the status of the report. How exactly can be done I cant tell you but as I remember this graphical manager works through tnsnames.ora configuration.

                  Best regards.
                  • 6. Re: How to Check the report is Finished while calling a report from Forms 6i
                    InoL
                    You are mixing Forms 6i client/server and web mode calls in one procedure. This is c/s:
                    Run_Product(REPORTS,:fn_cntl.nb_report_name,ASYNCHRONOUS, RUNTIME, FILESYSTEM,pl_id, NULL);
                    and this for web mode:
                    repid := find_report_object('MMAT_REPORT');      v_rep := RUN_REPORT_OBJECT(repid);
                    Now, if you want to use c/s mode, just change ASYNCHRONOUS to SYNCHRONOUS. The procedure will wait for the report to finish before continuing. From the Help:
                    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.
                    I need to copy the pdf to store it in another place once the report is generated.
                    You can use the HOST command to copy the file. But why not generate it directly to the final destination?
                    • 7. Re: How to Check the report is Finished while calling a report from Forms 6i
                      user3029023
                      Thanks "SYNCHRONOUS" works for me.....
                      You can use the HOST command to copy the file. But why not generate it directly to the final destination?
                      Actually i need to store the file in two places one in C :\ and another in another place in another server... I am already using Host command that works fine....


                      Thank A lot for Help
                      • 8. Re: How to Check the report is Finished while calling a report from Forms 6i
                        HamidHelal
                        user3029023 wrote:
                        Thank A lot for Help
                        Hi,
                        Can you post the solution that works for you ? It will help everybody...
                        and mark helpful post.

                        Hamid