Sunday, July 5, 2015

Call Oracle Report 6i



In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,


Task Definition:  Call an Oracle Report from Oracle forms 6i



Task Solution:  create a parameter form with the non database block, with the form items you would like to pass its data to the report. Create a button with WHEN-BUTTON PRESSED Trigger and paste the following code and make the necessary changes according to your needs.

 DECLARE
   pl_emp  PARAMLIST; -- Define a parameter list
 BEGIN
 /* Let's have some fun to simplify the task solution*/
 /* On going to the market…
 Think about getting a container for collecting items you need
First you have to get your parameter list.
 The parameter list variable is also looks like the container you need to collect the parameters you need so we use Get_Parameter_List with a name what so ever…*/
         pl_ emp  := Get_Parameter_List('tmpdata');
        /* Verify if the container or the parameter list is full  to clear any item or any parameter it includes*/
   IF NOT Id_Null(pl_emp ) THEN 
           Destroy_Parameter_List( pl_ emp );
   END IF;         
    /* Now it's time to create a new list using Create_Parameter_List with the same name you have gotten before. */
   pl_emp  := Create_Parameter_List('tmpdata'); 
     /* Now it's your turn to choose whatever items you need from the market  to create a new list using Create_Parameter_List with the same name you have gotten before. */
      Add_Parameter(pl_emp  ,'paramform',TEXT_PARAMETER,'NO');
     Add_Parameter(pl_emp  ,'p_ emp_no',TEXT_PARAMETER, :p_emp_no );                                
/*Note all parameters data types MUST be CHAR datatype.*/
     Add_Parameter(pl_dept,'P_D_F',TEXT_PARAMETER,TO_CHAR(:p_hire_date,'DD/MM/YYYY'));
/*Note all Global variables data types are always CHAR datatype.*/
      Add_Parameter(pl_dept,'P_G_USER',TEXT_PARAMETER, :GLOBAL.USER_ID);
/*Now let's call the report with Run_Product, but wait, first you have to create report parameters with the same parameter name and the same data type corresponding forms parameters in the Add_Parameter statement  which is encountered with single quote e.g. 'p_ emp_no' .*/
Run_Product(REPORTS, 'EMP_REP.rep', SYNCHRONOUS, RUNTIME,FILESYSTEM, pl_dept,NULL);



 Hope this helps…


My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.