Home » Developer & Programmer » Reports & Discoverer » Need output in pdf (Reports 6i)
Need output in pdf [message #553701] Tue, 08 May 2012 01:32
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

We are using the following to run the report from form , now we want the output to come directly as pdf (open directly into pdf) is that possible we are using the following code.

IF :M_DEST_TYPE IN ('P','V','W','E','M','H','F','X') THEN
	O_RUN_REPORT(:CONTROL.M_LANG_CODE,:CTRL.M_USER_ID,:GLOBAL.M_PARA_2,
			:GLOBAL.M_PARA_2,:GLOBAL.M_PARA_2,'B', :REP_DFLT.M_DEST_TYPE);
END IF;

--O_RUN_REPORT is a program unit where 'P' is for preview,'W' - For winword,'E' -For excel and the code below is for run report.
PROCEDURE O_RUN_REPORT( LANG_CODE   IN VARCHAR2,
			USER_ID     IN VARCHAR2,
		 	MODULE_NAME IN VARCHAR2,
			BITM_REP_ID IN VARCHAR2,
			CHAR_REP_ID IN VARCHAR2,
			REP_MODE    IN VARCHAR2,
			DEST_TYPE   IN VARCHAR2 ) IS

  PARAM_ID	PARAMLIST;
/*
  RG_PARAM	RECORDGROUP;
  GC_FROM_VAL     GROUPCOLUMN;
  GC_TO_VAL	GROUPCOLUMN;
  RG_PARAM_VAL	NUMBER;
  DFLT_LANG	VARCHAR2(3) := 'ENG';
*/
  M_COMP_CODE	VARCHAR2(12); 

  M_RIGHT_LANG	VARCHAR2(80) ;
  M_LEFT_LANG	VARCHAR2(80) ;
  M_CURR_NLS_LANG	VARCHAR2(80) ;


CURSOR C3 IS 
          SELECT DECODE(LANG_CODE,'ENG',COMP_NAME,COMP_BL_NAME) COMP_NAME FROM FM_COMPANY
	  WHERE COMP_CODE = M_COMP_CODE;	
		
C3_REC   C3%ROWTYPE;

BEGIN

   SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');

-- CREATE PARAMETER LIST

   PARAM_ID := GET_PARAMETER_LIST('PL_PARAM'); 
   IF NOT ID_NULL(PARAM_ID) THEN 
      DESTROY_PARAMETER_LIST(PARAM_ID);
   END IF; 
   PARAM_ID := CREATE_PARAMETER_LIST('PL_PARAM'); 
   IF ID_NULL(PARAM_ID) THEN 
      MESSAGE('ERROR CREATING PARAMETER LIST PL_PARAM'); 
      SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
      RAISE FORM_TRIGGER_FAILURE; 
   END IF; 

/*
-- REPORT PARAMETERS

   RG_PARAM := FIND_GROUP('RG_PARAM');

   RG_PARAM_VAL := POPULATE_GROUP(RG_PARAM);

   GC_FROM_VAL := FIND_COLUMN('RG_PARAM.GC_FROM_VAL');
   GC_TO_VAL   := FIND_COLUMN('RG_PARAM.GC_TO_VAL');

-- TO SET THE VALUES OF THE PARAMETER IN THE RECORD GROUP;
   L_SET_USER_PARAMETERS(RG_PARAM,GC_FROM_VAL,GC_TO_VAL);
*/
	
   M_COMP_CODE := NAME_IN('GLOBAL.M_COMP_CODE');
      
   OPEN C3;
   FETCH C3 INTO C3_REC;
   CLOSE C3;	

-- ADD REPORT PARAMETERS
   
-- TITLES

   ADD_PARAMETER(PARAM_ID,'M_COMP_CODE',  TEXT_PARAMETER,M_COMP_CODE);    
   ADD_PARAMETER(PARAM_ID,'P_USER_NAME',  TEXT_PARAMETER,USER_ID);    
   ADD_PARAMETER(PARAM_ID,'P_REP_NAME', TEXT_PARAMETER,BITM_REP_ID);   


-- USER PARAMETERS
--   ADD_PARAMETER(PARAM_ID,'USER_PARAM', DATA_PARAMETER,'RG_PARAM'); 

-- SET SYSTEM PARAMETERS

   ADD_PARAMETER(PARAM_ID,'PARAMFORM',TEXT_PARAMETER,'NO'); 
   ADD_PARAMETER(PARAM_ID,'P_DT_FMT_MASK',TEXT_PARAMETER,NAME_IN('CTRL.M_DT_FMT_MASK')); 
   ADD_PARAMETER(PARAM_ID,'P_LANG_CODE',TEXT_PARAMETER,LANG_CODE); 
   ADD_PARAMETER(PARAM_ID,'COPIES',TEXT_PARAMETER,NAME_IN('REP_DFLT.M_NO_OF_COPIES')); 

   IF DEST_TYPE = 'V' THEN
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'PREVIEW'); 
   ELSIF DEST_TYPE = 'P' THEN
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'PRINTER'); 
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER,NAME_IN('REP_DFLT.M_DESNAME')); 
   ELSIF DEST_TYPE = 'W' THEN
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'FILE'); 
      ADD_PARAMETER(PARAM_ID,'DESFORMAT',TEXT_PARAMETER,'RTF');
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER,NAME_IN('REP_DFLT.M_DEST_NAME')); 
   ELSIF DEST_TYPE = 'E' THEN
   	

   	  ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'FILE'); 
      ADD_PARAMETER(PARAM_ID,'DESFORMAT',TEXT_PARAMETER,'XML');
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER,SUBSTR(NAME_IN('REP_DFLT.M_DEST_NAME'),1,INSTR(NAME_IN('REP_DFLT.M_DEST_NAME'),'.')-1)||'.XML'); 
   ELSIF DEST_TYPE = 'M' THEN
   	  -- Mail
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'MAIL');
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER, NAME_IN('REP_DFLT.M_DEST_NAME'));
      ADD_PARAMETER(PARAM_ID,'DESFORMAT',TEXT_PARAMETER,'HTML');
   ELSIF DEST_TYPE = 'H' THEN
   	  -- HTML
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'FILE'); 
      ADD_PARAMETER(PARAM_ID,'DESFORMAT',TEXT_PARAMETER,'HTML');
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER,NAME_IN('REP_DFLT.M_DEST_NAME')); 
   ELSIF DEST_TYPE = 'F' THEN
   	  -- PDF
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'FILE'); 
      ADD_PARAMETER(PARAM_ID,'DESFORMAT',TEXT_PARAMETER,'PDF');
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER,NAME_IN('REP_DFLT.M_DEST_NAME')); 
   ELSIF DEST_TYPE = 'X' THEN
   	  -- XML
      ADD_PARAMETER(PARAM_ID,'DESTYPE',TEXT_PARAMETER,'FILE'); 
      ADD_PARAMETER(PARAM_ID,'DESFORMAT',TEXT_PARAMETER,'XML');
      ADD_PARAMETER(PARAM_ID,'DESNAME',TEXT_PARAMETER,NAME_IN('REP_DFLT.M_DEST_NAME')); 
   END IF;

-- USER PARAMETERS DEPENDING ON THE REPORT

   L_SET_REPORT_PARAMETER(PARAM_ID);

   SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');

-- RUN REPORT

   M_LEFT_LANG		:= 'AMERICAN_AMERICA' ;
   M_RIGHT_LANG		:= 'ARABIC_SAUDI ARABIA' ;

   O_SET_REPORT_NLS(M_CURR_NLS_LANG,M_LEFT_LANG,M_RIGHT_LANG) ;

   IF REP_MODE = 'B' THEN
      ADD_PARAMETER(PARAM_ID,'MODE',TEXT_PARAMETER,'BITMAP'); 	      
      RUN_PRODUCT(REPORTS,BITM_REP_ID,SYNCHRONOUS,RUNTIME,
		FILESYSTEM,PARAM_ID,NULL);
   END IF; 

   M_LEFT_LANG		:= 'AMERICAN_AMERICA' ;
   M_RIGHT_LANG		:= 'ARABIC_SAUDI ARABIA' ;

   O_RESET_REPORT_NLS(M_CURR_NLS_LANG) ;

   DESTROY_PARAMETER_LIST(PARAM_ID) ;
   CLEAR_MESSAGE;
   IF DEST_TYPE = 'E' THEN
   	 CREATE_EXCEL_REPORT(NAME_IN('REP_DFLT.M_DEST_NAME'),SUBSTR(NAME_IN('REP_DFLT.M_DEST_NAME'),1,INSTR(NAME_IN('REP_DFLT.M_DEST_NAME'),'.')-1)||'.XML');
   END IF;	
  
END;

Previous Topic: Error on pressing hyperlink of the object in a report
Next Topic: report output
Goto Forum:
  


Current Time: Wed Nov 27 01:29:04 CST 2024