Wednesday 10 December 2014

Report Printing code in oracle forms 11g  With parameter

DECLARE          
   v_parameter_id PARAMLIST;
   v_report_title  VARCHAR2(200) := NULL;
   v_finyear_title VARCHAR2(200) := NULL;
   v_branch_title  VARCHAR2(200) := NULL;
   v_period_title  VARCHAR2(200) := NULL;
   v_report_code   fatempreport.report_code%TYPE;
   
  --Code added by CTE
  REPORT_ID      Report_object;

BEGIN

   IF frmpkg_general.data_check() = TRUE 
THEN
   
 v_parameter_id := get_parameter_list('REPOPARAMETER');
 
  IF NOT id_null(v_parameter_id) 
  THEN
      destroy_parameter_list(v_parameter_id);
  END IF;

 v_parameter_id := create_parameter_list('REPOPARAMETER');
 IF NOT id_null(v_parameter_id) 
 THEN
 
         add_Parameter(v_parameter_id, 'DESTYPE', TEXT_PARAMETER, null);
    add_Parameter(v_parameter_id, 'DESFORMAT', TEXT_PARAMETER, null);
    add_Parameter(v_parameter_id, 'DESNAME', TEXT_PARAMETER, null);
    add_Parameter(v_parameter_id, 'COPIES', TEXT_PARAMETER, 1);
  add_parameter(v_parameter_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
         add_parameter(v_parameter_id, 'P_COMPANY_NAME', TEXT_PARAMETER,                                :GLOBAL.g_company_name);
         Message('Processing, Please wait....', NO_ACKNOWLEDGE);
         SYNCHRONIZE;
      
      IF :PARAMETER.P_REPORT_TYPE = 'JOURNAL_PERIOD_WISE'
      THEN

         v_finyear_title := TO_CHAR(:report_block.txt_from_date,:GLOBAL.g_date_format) || ' - ' || TO_CHAR(:report_block.txt_to_date,:GLOBAL.g_date_format);
         v_branch_title := :GLOBAL.g_branch_name;
         v_report_title  :=  :report_block.txt_journal_name;
         v_period_title := TO_CHAR(:report_block.txt_from_date,:GLOBAL.g_date_format) || ' - ' || TO_CHAR(:report_block.txt_to_date,:GLOBAL.g_date_format);
add_parameter(v_parameter_id, 'P_BOOK_CODE',TEXT_PARAMETER, :report_block.lb_journal);
add_parameter(v_parameter_id,'P_BRANCH_CODE',TEXT_PARAMETER,:GLOBAL.g_branch_code);
add_parameter(v_parameter_id, 'P_BRANCH_TITLE', TEXT_PARAMETER, v_branch_title);
add_parameter(v_parameter_id,'P_FINYEAR_CODE',TEXT_PARAMETER,:GLOBAL.g_finyear_code);
add_parameter(v_parameter_id, 'P_FINYEAR_TITLE', TEXT_PARAMETER, v_finyear_title);
add_parameter(v_parameter_id,'P_FROM_DATE',TEXT_PARAMETER,:report_block.txt_from_date);
add_parameter(v_parameter_id, 'P_PERIOD_TITLE', TEXT_PARAMETER, v_period_title);
add_parameter(v_parameter_id, 'P_REPORT_TITLE', TEXT_PARAMETER, v_report_title);
add_parameter(v_parameter_id, 'P_VOUCHERTYPE', TEXT_PARAMETER, :report_block.txt_voucher_type); 
add_parameter(v_parameter_id, 'P_TO_DATE', TEXT_PARAMETER, :report_block.txt_to_date);
add_parameter(v_parameter_id, 'P_HIDE_CANCELLED', TEXT_PARAMETER, :report_block.chk_hide_cancelled);
    
REPORT_ID:=FIND_REPORT_OBJECT('REPOBJ');
                      SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME,'JournalPeriodWise');
                   web_report_xl(REPORT_ID, v_parameter_id);
      END IF;
         
         Message(' ');

  destroy_parameter_list(v_parameter_id);
 END IF;
 
   END IF;
END;

/*----------------------------Excel Print------------------*/
PROCEDURE WEB_REPORT_XL (REPID REPORT_OBJECT, PLID PARAMLIST)IS
  REPORT_JOB_ID     VARCHAR2(100);  
  REP_STATUS        VARCHAR2(100);  
  REPORTSERVERJOB   VARCHAR2(100);    
BEGIN  
SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_COMM_MODE,SYNCHRONOUS);
  SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_DESTYPE,CACHE);                
  SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_DESFORMAT,'SPREADSHEET');
SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_SERVER,'repserv');
  REPORT_JOB_ID := RUN_REPORT_OBJECT (REPID,PLID);  
  REP_STATUS := REPORT_OBJECT_STATUS (REPORT_JOB_ID);  
  IF REP_STATUS = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('http://100.100.11.100:8888/reports/rwservlet/getjobid='||substr(report_job_id,instr(report_job_id,'_',-1)+1)||'?server='||'repserv'||'+MIMETYPE=REPORTS/LOCAL','_self');
ELSE
    MESSAGE ('Report Failed with Error - ' || REP_STATUS);
  END IF;
END;

/*----------------------------Pdf Print------------------*/
PROCEDURE WEB_REPORT (REPID REPORT_OBJECT, PLID PARAMLIST)IS
  REPORT_JOB_ID     VARCHAR2(100);  
  REP_STATUS        VARCHAR2(100);  
  REPORTSERVERJOB   VARCHAR2(100);    
BEGIN  
SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_COMM_MODE,SYNCHRONOUS);
  SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_DESTYPE,CACHE);                
  SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY (REPID,REPORT_SERVER,'repserv');
  REPORT_JOB_ID := RUN_REPORT_OBJECT (REPID,PLID);  
  REP_STATUS := REPORT_OBJECT_STATUS (REPORT_JOB_ID);  
  IF REP_STATUS = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('http://100.100.100.11:8888/reports/rwservlet/getjobid='||substr(report_job_id,instr(report_job_id,'_',-1)+1)||'?server='||'repserv','_blank');
ELSE
    MESSAGE ('Report Failed with Error - ' || REP_STATUS);
  END IF;
END;


2 comments:

  1. Excel produced from 11g report builder using your code without guide line .how get it these guide line .

    ReplyDelete
  2. Excel produced from 11g report builder using your code without guide line .how get it these guide line .

    ReplyDelete

Copyright © ORACLE-FORU - SQL, PL/SQL and ORACLE D2K(FORMS AND REPORTS) collections | Powered by Blogger
Design by N.Design Studio | Blogger Theme by NewBloggerThemes.com