Sunday, July 5, 2015

 Call Oracle Report 6i  From Forms

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,

ask Definition:T

Call an Oracle Report 6i  from Oracle forms 6i.

Task Solution:

 /* Let's have some fun to simplify the task solution */
 /* In the following few lines...
 /* i will simply explain to beginners an example 
 /* that make them imagine what is parameter list & parameters*/
 /* Why ? 
 /* Since it's hard for newbies to recognize how invisible data are used
 /* between  forms or between a form and a report.*/

//////////////////// Start Example Story /////////////////////// 
 /* On going to a Hyper Market… 
    The First thing you would think about is getting a container 
    - a basket or supermarket trolley - for collecting items you need.

   Imagine, the container is the parameter list you have to create for your parameters. It is only one parameter list needed for each report or a form.

   The parameters are the items you have to create for each parameter list.
Imagine,the parameters same are those items you choose to purchase according to your needs from the Hyper Market. */

//////////////////// Example Story End ///////////////////////

    Now Let's Start Implementing The Idea

   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. 
 Note: Don't forget to customize your parameter names and data types according to  your needs.

   pl_emp  PARAMLIST; -- Define a parameter list
   pl_ emp  := Get_Parameter_List('tmpdata');
        /* Verify if the container or the parameter list status; is it full ? if yes then you have to
clear its parameters */
   IF NOT Id_Null(pl_emp ) THEN 
           Destroy_Parameter_List( pl_ emp );
   END IF;         
    /* Now it's time to create a new empty parameter list using Create_Parameter_List with 
the same name you have gotten before. */
   pl_emp  := Create_Parameter_List('tmpdata'); 
     /*  Now let's  choose the items from the market , in other words, let's create the parameters 
to fill up the parameter list. */
Attention Pls.:
1- Each parameter you create must match the same parameter name and data type
of the target report or form.
2- All parameters must be CHAR datatype involving date and numbers datatypes. */
  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.*/
/*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
a report parameters with the same parameter name and data type corresponding to
forms parameters created with Add_Parameter statements e.g. 'p_ emp_no' .*/

 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.

No comments :