Calling a package  in Data template

Hi All ,
I am using Data template for XML generation and want to call a PL/SQL package.I have gone through some of the threads on the topic.
I have some doubts in this regard :
1)Can we have procedures inside package or its just the functions that can be called.
2)Does the package gets executed every time we generate the report.(It got executed for me just once).
3)The parameters defined in the data tamplte can be passed to the PAckage as well?
4) Is this supported on BIP 10.1.3.2 or XML publisher 5.6.2?
Thanks!!

Thanks for your detailed answer!!
I am trying to call a package just to understand how it works .This package just inserts a row in "suppliers" table.I ma calling this package through 'beforeReprot' trigger and querying the table after that.
I have written a package "test_pack" :
create or replace
package test_pack as
function test_insert_fun return boolean;
end test_pack;
create or replace
package body test_pack as
function test_insert_fun return boolean is
begin
insert into suppliers values (1,'p1','p2');
return (TRUE);
end;
end test_pack;
Data Template :
<dataTemplate name="test" dataSourceRef="demo" defaultpackage="test_pack">
     <dataQuery>
          <sqlStatement name="Q1">
               <![CDATA[SELECT * from suppliers]]>
          </sqlStatement>
     </dataQuery>
     <dataTrigger name="beforeReport" source="test_pack.test_insert_fun()"/>
</dataTemplate>
However after this , when I try to view data , I amnot seeing any output.When i go nad check the suppliers table in db, i dont see any values.
I believe this package should be executed everytime i view the data.
Please advice!!

Similar Messages

  • Calling Sql Procedure from data template

    Hello,
    I am facing problem to call a stored procedure which inserts data into DB when a report is generated.
    I tried to use data trigger before report, It did not call the procedure nor it gave any error.
    I looked into thread dataTrigger beforeReport doesn't fire
    and used the defaultPackage = "SEQUENCE_NUMBER", I am getting error parameter not declared
    listing all the parameters declared in my XML.
    Below is my data template
    <dataTemplate name="HURDetail" dataSourceRef="BRM_DATA_SOURCE">
         <parameters>
              <parameter name="PARAM_REPORT_TYPE" dataType="character" defaultValue="%"/>
              <parameter name="PARAM_ROAMING_PART_NAME" dataType="character" defaultValue="%"/>
              <parameter name="PARAM_START_DATE" dataType="character"/>
              <parameter name="PARAM_END_DATE" dataType="character"/>
         </parameters>
         <dataQuery>
              <sqlStatement name="Q1">
                   <![CDATA[
    SELECT  
    "EVENT_DLAY_SESS_TLCS_T"."SECONDARY_MSID" as MSID,
    MIN("EVENT_T"."START_T") DFC,
    MAX("EVENT_T"."START_T") DATE_LAST_CALL,
    COUNT ("EVENT_DLAY_SESS_TLCS_T"."SECONDARY_MSID") NC,
    TO_CHAR( SUM("EVENT_BAL_IMPACTS_T"."AMOUNT_ORIG"),'FM000000000.000') SDR,
    "EVENT_DLAY_SESS_TLCS_T"."SVC_CODE" as SVC_CODE,
    "IFW_EXCHANGE_RATE"."TO_CURRENCY" as CURR,
    "IFW_EXCHANGE_RATE"."EXCHANGE_RATE" as EXC_RATE
    FROM
    ((((SERVICE_T "SERVICE_T" INNER JOIN SERVICE_ALIAS_LIST_T "SERVICE_ALIAS_LIST_T" ON
    "SERVICE_T"."POID_ID0" = "SERVICE_ALIAS_LIST_T"."OBJ_ID0")
    INNER JOIN (EVENT_DLAY_SESS_TLCS_T "EVENT_DLAY_SESS_TLCS_T" INNER JOIN EVENT_T "EVENT_T" ON
    "EVENT_DLAY_SESS_TLCS_T"."OBJ_ID0" = "EVENT_T"."POID_ID0") ON
    "SERVICE_T"."POID_ID0" = "EVENT_T"."SERVICE_OBJ_ID0")
    INNER JOIN EVENT_BAL_IMPACTS_T "EVENT_BAL_IMPACTS_T" ON
    "EVENT_T"."POID_ID0" = "EVENT_BAL_IMPACTS_T"."OBJ_ID0")
    INNER JOIN CONFIG_BEID_BALANCES_T "CONFIG_BEID_BALANCES_T" ON
    "EVENT_BAL_IMPACTS_T"."RESOURCE_ID" = "CONFIG_BEID_BALANCES_T"."REC_ID")
    INNER JOIN IFW_EXCHANGE_RATE "IFW_EXCHANGE_RATE" ON
    "CONFIG_BEID_BALANCES_T"."BEID_STR_CODE" = "IFW_EXCHANGE_RATE"."FROM_CURRENCY"
    WHERE (   
    ("EVENT_T"."START_T">=bipext.infstrtotimet(:PARAM_START_DATE,2) AND
    "EVENT_T"."START_T"<=bipext.infstrtotimet(:PARAM_END_DATE,2)-1) AND
    "SERVICE_ALIAS_LIST_T"."NAME" = :PARAM_ROAMING_PART_NAME AND
    "EVENT_T"."SERVICE_OBJ_TYPE" = '/service/settlement/roaming/outcollect' AND
    "EVENT_T"."POID_TYPE" = '/event/delayed/session/telco/gsm/roaming' AND
    "IFW_EXCHANGE_RATE"."TO_CURRENCY" = 'EUR' AND
    bipext.infCheckDates(:PARAM_START_DATE, :PARAM_END_DATE) = 1
         ]]>
         </sqlStatement>
         </dataQuery>
         <dataTrigger name="beforeReport" source="SEQUENCE_NUMBER.Seq_Num_Gen_Proc(:PARAM_START_DATE, :PARAM_END_DATE, :PARAM_ROAMING_PART_NAME, :PARAM_REPORT_TYPE)"/>
         <datastructure>
              <group name="Q1" source="Q1">
                   <element name="MSID" value="MSID"/>
                   <element name="DFC" value="DFC"/>
                   <element name="DATE_LAST_CALL" value="DATE_LAST_CALL"/>
                   <element name="NC" value="NC"/>
                   <element name="DC_HHHMMSS" value="DC_HHHMMSS"/>
                   <element name="SDR" value="SDR"/>
                   <element name="SVC_CODE" value="SVC_CODE"/>
                   <element name="CURR" value="CURR"/>
                   <element name="EXC_RATE" value="EXC_RATE"/>
              </group>
         </datastructure>
    </dataTemplate>
    Please suggest, How to call a stored procedure

    1. Does dataTrigger triggers the procedure only when we execute the report and not when we just view the report ?
    2.If I add defaultPackage="HUR_Seq_NUM" in my template I get the error
    ORA-06550: line 2, column 13:
    PLS-00302: component 'PARAM_REPORT_TYPE' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 3, column 13:
    PLS-00302: component 'PARAM_ROAMING_PART_NAME' must be declared
    ORA-06550: line 3, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 4, column 13:
    PLS-00302: component 'PARAM_START_DATE' must be declared
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    ORA-06550: line 5, column 13:
    PLS-00302: component 'PARAM_END_DATE' must be declared
    ORA-06550: line 5, column 1:
    PL/SQL: Statement ignored

  • Calling Oracle Functions in Data Template

    Hi,
    I have a package and 2 functions inside that, I need to use those 2 functions inside my BI Publisher Data Template,
    Package1
    Function1(Param1 varchar2,param2 varchar2) return Refcursor
    Open Refcursor for
    Select Fun1Col1,Fun1Col2,Fun1Col3 from ABCD;
    Function2(Param1 varchar2 , Fun1Col1 varchar2,Fun1Col2 varchar2 ) return Refcursor
    Open Refcursor for
    Select Fun2Col1,Fun2Col2,Fun2Col3 from XYZ where XXX=Fun1Col1 and YYY=Fun1Col2 and ZZZ=Param1;
    Here the Second Function is using the Output Columns of First Function as Input Parameters.
    The above functions are created for Oracle Reports which is working fine, Now I am converting them from Oracle Reports to BI Publisher and I am not able to proceed.
    I have designed my Data Template as follows.
    <dataTemplate name="XYZ " description="XYZ" defaultPackage="">
         <!-- Property to make XML Output tags UPPERCASE -->
         <properties>
              <property name="scalable_mode" value="off"/>
              <property name="debug_mode" value="off"/>
         </properties>
         <!-- Parameters -->
         <parameters>
              <parameter name="Param1" dataType="varchar2"/>
              <parameter name="Param2" dataType="varchar2"/>
         </parameters>
         <!-- Lexicals -->
         <lexicals/>
         <!-- SQL Queries -->
         <dataQuery>
              <sqlStatement name="Q_Container_Query">
                   <![CDATA[
    Select Package1.Function1(:param1,:param2) from dual;
    ]]>
              </sqlStatement>
              <sqlStatement name="Q_Container_Item_Query">
                   <![CDATA[
    Select Package1.Function2(:param1,:Fun1Col1,:FunCol2) from dual
    ]]>
              </sqlStatement>
         </dataQuery>
         <!-- Grouping -->
         <dataStructure>
              <group name="G_Container_Query" source="Q_Container_Query">
                   <element name="Fun1Col1" value="Fun1Col1"/>
    <element name="Fun1Col2" value="Fun1Col2"/>
    <element name="Fun1Col3" value="Fun1Col3"/>
                   <group name="G_Container_Item_Query" source="Q_Container_Item_Query">
                   <element name="Fun2Col1" value="Fun2Col1"/>
    <element name="Fun2Col2" value="Fun2Col2"/>
    <element name="Fun2Col3" value="Fun2Col3"/>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    The point of concern is whether
    Select Package1.Function2(:param1,:Fun1Col1,:FunCol2) from dual
    is valid or not, because its accepting Function1's output values as Input Parameters.
    Regards,
    Ashoka BL

    Could anyone please reply....

  • Calling a package function in the data template

    Hello All,
    I am not able to understand the concept of calling a function from the data template.
    In my data template, I put the sql statement as
    <sqlStatement name="Q_SEL">
    <![CDATA[  Select l_period_name PERIOD_NAME
                             from xla_tb_ap_report_pvt.get_period_name(1) ]]>
    </sqlStatement>
    Is it possible to call a specific package function as shown above in a select statement?
    I am getting the message "ORA-00933: SQL command not properly ended" when I tried with the above. Could you pls. point out what the error is in the above sqlStatement?
    1) My instance is R12.1.3
    2) The base pkg function 'xla_tb_ap_report_pvt.get_period_name' expects a number to be passed in as 'IN' parameter.
    Thanks,
    Monkey

    I tried another version of the sql statement (after going through some older posts) like:
    <sqlStatement name="Q_SEL">
    <![CDATA[  Select xla_tb_ap_report_pvt.get_period_name(1) PERIOD_NAME
                            from  dual]]>
    </sqlStatement>
    My group is :
    <group name="G_PERIOD_NAME" source="Q_SEL">
    <element name="PERIOD_NAME" value="PERIOD_NAME"/>
    </group>
    Now getting the error message:
    ORA-00904: xla_tb_ap_report_pvt.get_period_name : invaild identifier
    What is it that i am doing wrong?
    Thanks,
    Monkey
    Edited by: OAF_Monkey on Mar 26, 2012 11:52 AM

  • Does BI Data Template allows calling of a package insite group element

    Hi
    Is it possible to call a package inside the group element tag.
    When i try to call a package outside the group element it works out, but when I try to call it inside the group element it doesnt return any result.
    Am currently using BI Publisher version of 5.6.3 in Oracle Applications 12.1.3
    Regards
    Anoop

    Thanks for your detailed answer!!
    I am trying to call a package just to understand how it works .This package just inserts a row in "suppliers" table.I ma calling this package through 'beforeReprot' trigger and querying the table after that.
    I have written a package "test_pack" :
    create or replace
    package test_pack as
    function test_insert_fun return boolean;
    end test_pack;
    create or replace
    package body test_pack as
    function test_insert_fun return boolean is
    begin
    insert into suppliers values (1,'p1','p2');
    return (TRUE);
    end;
    end test_pack;
    Data Template :
    <dataTemplate name="test" dataSourceRef="demo" defaultpackage="test_pack">
         <dataQuery>
              <sqlStatement name="Q1">
                   <![CDATA[SELECT * from suppliers]]>
              </sqlStatement>
         </dataQuery>
         <dataTrigger name="beforeReport" source="test_pack.test_insert_fun()"/>
    </dataTemplate>
    However after this , when I try to view data , I amnot seeing any output.When i go nad check the suppliers table in db, i dont see any values.
    I believe this package should be executed everytime i view the data.
    Please advice!!

  • How to call a PL/SQL procedure from a xml Data Template

    We have a requirement in which we need to call a pl/sql package.(dot)procedure from a Data Template of XML Publisher.
    we have registered a Data Template & a RTF Template in the XML Publisher Responsibility in the Oracle 11.5.10 instance(Front End).
    In the Data Query part of the Data Template , we have to get the data from a Custom View.
    This view needs to be populated by a PL/SQL procedure.And this procedure needs to be called from this Data Template only.
    Can anybody suggest the solution.
    Thanks,
    Sachin

    Call the procecure in the After Parameter Form trigger, which can be scripted in the Data Template.
    BTW, there is a specialized XML Publisher forum:
    BI Publisher

  • I cant call a procedure within a data template

    Hi,
    I m working in a data template because i want to call a prcedure befor running the report.
    My procedure is under the folder of procedure. it is not under a package.
    So i left the defaultpackage empty in the data model.
    *<dataTemplate name="Extraction_Template" dataSourceRef="mydatasource" defaultPackage="">*
    But it didsn't work.
    Help.
    SAAD

    The default package attribute is required if your data template contains any other calls to PL/SQL. For the source attribute for the data trigger definition, you need to have the source in the form of <package name>.<function name>
    Check out the report designer's guide for details.
    Thanks,
    BIPuser

  • Calling a package procedure with Date parameter only

    Hi All,
    Please help me to call a package procedure with Date parameter from sql prompt.
    Arif

    Check the below procedure.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure procdate (p_date_in date)
      2  is
      3  p_date_out date;
      4  begin
      5  p_date_out := add_months(p_date_in,6);
      6  dbms_output.put_line(p_date_out);
      7* end;
    SQL> /
    Procedure created.
    SQL> exec procdate('01-JAN-2010');
    01-JUL-10
    PL/SQL procedure successfully completed.
    SQL> exec procdate(to_date('01/01/2010','DD-MM-YYYY'));
    01-JUL-10
    PL/SQL procedure successfully completed.
    SQL> exec procdate('31-DEC-2010');
    30-JUN-11
    PL/SQL procedure successfully completed.

  • How to call oracle Function which has If else condition in Data Template

    Hi,
    currently I am working on creating Data Template which uses a Oracle Function which I need to make use in my data template. But I have some confusions on using the same. Could anybody please help me in this regard.
    I have a function like this,
    function invoice_query (p_facility_id facility.facility_id%TYPE,
    p_wave_nbr pick_directive.wave_nbr%TYPE,
    p_container_id unit_pick_group_detail.container_id%TYPE,
    p_distro_nbr unit_pick_group_detail.distro_nbr%TYPE) return invoice_refcur IS
    refcur invoice_refcur;
    begin
    IF p_wave_nbr IS NOT NULL THEN
    OPEN refcur FOR SELECT t1.distro_nbr,
    t1.cust_order_nbr,
    t1.pick_not_before_date,
    SYSDATE,
    t1.ship_address_description,
    t1.ship_address1,
    t1.ship_address2,
    t1.ship_address3,
    t1.ship_address4,
    t1.ship_address5,
    t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
    t1.ship_country_code,
    t1.bill_address_description,
    t1.bill_address1,
    t1.bill_address2,
    t1.bill_address3,
    t1.bill_address4,
    t1.bill_address5,
    t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
    t1.bill_country_code,
    min(t2.pick_order),
    NULL,
    t2.wave_nbr
    FROM stock_order t1,
    pick_directive t2,
    unit_pick_group_detail t3
    WHERE t1.facility_id = t2.facility_id
    AND t1.facility_id = t3.facility_id
    AND t2.facility_id = t3.facility_id
    AND t1.distro_nbr = t2.distro_nbr
    AND t1.distro_nbr = t3.distro_nbr
    AND t2.distro_nbr = t3.distro_nbr
    AND t1.facility_id = p_facility_id
    AND t2.wave_nbr = p_wave_nbr
    AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
    AND t2.pick_type = 'U'
    AND t3.group_id in (SELECT t4.group_id
    FROM unit_pick_group t4
    WHERE t4.facility_id = p_facility_id
    AND t4.wave_nbr = p_wave_nbr)
    GROUP BY t1.distro_nbr,
    t1.cust_order_nbr,
    t1.pick_not_before_date,
    t1.ship_address_description,
    t1.ship_address1,
    t1.ship_address2,
    t1.ship_address3,
    t1.ship_address4,
    t1.ship_address5,
    t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
    t1.ship_country_code,
    t1.bill_address_description,
    t1.bill_address1,
    t1.bill_address2,
    t1.bill_address3,
    t1.bill_address4,
    t1.bill_address5,
    t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
    t1.bill_country_code,
    t2.wave_nbr
    ORDER BY MIN(t3.group_id), MAX(t3.slot);
    elsif p_container_id is not null then
    OPEN refcur FOR SELECT distinct t1.distro_nbr,
    t1.cust_order_nbr,
    t1.pick_not_before_date,
    SYSDATE,
    t1.ship_address_description,
    t1.ship_address1,
    t1.ship_address2,
    t1.ship_address3,
    t1.ship_address4,
    t1.ship_address5,
    t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
    t1.ship_country_code,
    t1.bill_address_description,
    t1.bill_address1,
    t1.bill_address2,
    t1.bill_address3,
    t1.bill_address4,
    t1.bill_address5,
    t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
    t1.bill_country_code,
    NULL,
    t2.dest_id,
    null
    FROM stock_order t1,
    unit_pick_group_detail t2
    WHERE t1.facility_id = t2.facility_id
    and t1.distro_nbr = t2.distro_nbr
    and t1.facility_id = p_facility_id
    AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
    AND t2.container_id = p_container_id;
    else
    open refcur for SELECT distinct t1.distro_nbr,
    t1.cust_order_nbr,
    t1.pick_not_before_date,
    SYSDATE,
    t1.ship_address_description,
    t1.ship_address1,
    t1.ship_address2,
    t1.ship_address3,
    t1.ship_address4,
    t1.ship_address5,
    t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip,
    t1.ship_country_code,
    t1.bill_address_description,
    t1.bill_address1,
    t1.bill_address2,
    t1.bill_address3,
    t1.bill_address4,
    t1.bill_address5,
    t1.bill_city || ', ' || t1.bill_state || ' ' || t1.bill_zip,
    t1.bill_country_code,
    NULL,
    NULL,
    t3.wave_nbr
    FROM stock_order t1,
    unit_pick_group_detail t2,
    unit_pick_group t3
    WHERE t1.facility_id = t2.facility_id
    and t2.facility_id = t3.facility_id
    and t1.distro_nbr = t2.distro_nbr
    and t2.group_id = t3.group_id
    and t1.facility_id = p_facility_id
    AND g_scp(p_facility_id, 'interface_tcp_flag') = 'N'
    AND t2.distro_nbr = p_distro_nbr;
    END IF;
    return refcur;
    end;
    I have created data template like following,
    <sqlStatement name="Q_INVOICE">
                   <![CDATA[
              SELECT Pack_Slip_R.invoice_query(:P_FACILITY_ID,:P_WAVE_NBR,:P_CONTAINER_ID,:P_DISTRO_NBR) from dual
                                                     ]]>
    </sqlStatement>
    But how does I create a element for the "t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip" column in the oracle function. I normally create an element like following,
    <group name="G_INVOICE" source="Q_INVOICE">
                   <element name="CUST_ORDER_NBR" value="cust_order_nbr"/>
                   <element name=":dest_id" value="dest_id"/>
    </Group>
    But how do i create element if a column name is kind of dynamic. Please help. I cannot Rename/change the Column in SQL Query. Please let me know If I could handle this whole logic in BI Publsiher.
    Regards,
    Ashoka BL

    try useing alias
    t1.ship_city || ', ' || t1.ship_state || ' ' || t1.ship_zip as <COLUMN_ALIAS>

  • Data template datatrigger error

    Hi I have a data template that I'm currently getting an datatrigger error with when trying to generate the xml data. I believe I have my dataTrigger coded correctly and am unsure how to resolve this problem. Below is the data template code, plsql code and the actual error. Can somebody please tell me how to fix this error?
    Please help!
    <?xml version="1.0"?>
    <dataTemplate name="XXKNC_WIPDJCR" description="WIP Critical Ratio Report" dataSourceRef="TEST" version="1.0">
    <parameters>
    <parameter name="S_DEPT" dataType="character"/>
    <parameter name="E_DEPT" dataType="character"/>
    <parameter name="P_QTY_IN_QUEUE" dataType="character"/>
    </parameters>
    <dataQuery>
    <sqlStatement name="MAIN_Q1">
    <![CDATA[
    select distinct cr.Dept_Name, cr.Dept_Description,
    case
               when cr.denominator = 0 then 0
               else round(cr.numerator/cr.denominator,2)
    end critical_ratio,
    cr.Sched_Op_Start_Date, cr.Sched_Op_Completion_Date,
    to_char(cr.MPS_SCHEDULED_COMPLETION_DATE,'MM/DD/RRRR') as JOB_COMP_DATE,
    cr.Job_Name, cr.Lot_Number, cr.PART# as ITEM,
    substr(cr.Item_Description,1,50) as Item_Description, cr.Op_Seq as OPER,
    substr(cr.OP_Description,1,30) as OP_Description, cr.Quantity_Scheduled, cr.Quantity_In_Queue,        cr.QUANTITY_COMPLETED
    from
    select distinct a.Dept_Name, a.Dept_Description, a.Job_Name, a.wip_entity_id,       a.MPS_SCHEDULED_COMPLETION_DATE, round(xxknc_critical_ratio_num(a.wip_entity_id),4) as numerator,
    den.denominator, to_char(a.Sched_Op_Start_Date,'MM/DD/RRRR') as Sched_Op_Start_Date,
    to_char(a.Sched_Op_Completion_Date,'MM/DD/RRRR') as Sched_Op_Completion_Date,
    a.PART#, a.Item_Description, a.LOT_NUMBER, a.Quantity_Scheduled,  a.Quantity_In_Queue,
    a.QUANTITY_COMPLETED,  a.Op_Seq, a.OP_Description,
    xxknc.xxknc_qty_in_queue.CF_RowNumFormula as CF_RowNumFormula
    from
        select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
                   WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
                    WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
                  WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date, i.inventory_item AS PART#,
    i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq, WO.DESCRIPTION   OP_Description,
    WO.SCHEDULED_QUANTITY Quantity_Scheduled,  WO.QUANTITY_IN_QUEUE Quantity_In_Queue,
    WO.QUANTITY_COMPLETED, wor.usage_rate_or_amount, wor.applied_resource_units, wo.wip_entity_id
      from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, wip_operation_resources wor
           ,WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE, invfg_items i    
      where WO.ORGANIZATION_ID = 82
      and DJ.ORGANIZATION_ID = 82
      AND WE.ORGANIZATION_ID = 82
      AND i.ORGANIZATION_ID = 82
      AND BD.ORGANIZATION_ID = 82
      AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
      AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
      AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
      AND WE.ENTITY_TYPE = 1
      and dj.status_type = 3
      AND wo.wip_entity_id = dj.wip_entity_id
      AND wor.wip_entity_id = wo.wip_entity_id
      AND wor.operation_seq_num = wo.operation_seq_num
      AND wor.uom_code IN ('HR')
      and basis_type in (2)
      and activity_id in (4,1000)
      UNION
        select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
            WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
            WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
            WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
            i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
            WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled, 
            WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
           (wor.usage_rate_or_amount * WO.QUANTITY_COMPLETED) as usage_rate_or_amount,
           wor.applied_resource_units, wo.wip_entity_id
    from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, wip_operation_resources wor      ,WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE, invfg_items i
      where WO.ORGANIZATION_ID = 82
      and DJ.ORGANIZATION_ID = 82
      AND WE.ORGANIZATION_ID = 82
      AND i.ORGANIZATION_ID = 82
      AND BD.ORGANIZATION_ID = 82
      AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
      AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
      AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
      AND WE.ENTITY_TYPE = 1
      and dj.status_type = 3
      AND wo.wip_entity_id = dj.wip_entity_id
      AND wor.wip_entity_id = wo.wip_entity_id
      AND wor.operation_seq_num = wo.operation_seq_num
      AND wor.uom_code IN ('HR')
      and basis_type in (1)
      and activity_id in (1)
      UNION
        select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
             WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
             WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
             WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
             i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
             WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled, 
             WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
             (wor.usage_rate_or_amount * 24) as usage_rate_or_amount,
             wor.applied_resource_units, wo.wip_entity_id
      from apps.WIP_OPERATIONS wo,
           BOM_DEPARTMENTS BD, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE
           ,invfg_items i
      where WO.ORGANIZATION_ID = 82
      and DJ.ORGANIZATION_ID = 82
      AND WE.ORGANIZATION_ID = 82
      AND i.ORGANIZATION_ID = 82
      AND BD.ORGANIZATION_ID = 82
      AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
      AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
      AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
      AND WE.ENTITY_TYPE = 1
      and dj.status_type = 3
      AND wo.wip_entity_id = dj.wip_entity_id
      AND wor.wip_entity_id = wo.wip_entity_id
      AND wor.operation_seq_num = wo.operation_seq_num
      AND wor.uom_code IN ('DAY')
      and basis_type in (2)
      and activity_id in (4,1000)
      UNION
      select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,
             WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
             WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
             WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
             i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
             WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled, 
             WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
             ((wor.usage_rate_or_amount * 24) * WO.QUANTITY_COMPLETED) as usage_rate_or_amount,
             wor.applied_resource_units, wo.wip_entity_id
      from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, wip_operation_resources wor
          ,WIP_DISCRETE_JOBS DJ, WIP_ENTITIES WE, invfg_items i
      where WO.ORGANIZATION_ID = 82
      and DJ.ORGANIZATION_ID = 82
      AND WE.ORGANIZATION_ID = 82
      AND i.ORGANIZATION_ID = 82
      AND BD.ORGANIZATION_ID = 82
      AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
      AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
      AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
      AND WE.ENTITY_TYPE = 1
      and dj.status_type = 3
      AND wo.wip_entity_id = dj.wip_entity_id
      AND wor.wip_entity_id = wo.wip_entity_id
      AND wor.operation_seq_num = wo.operation_seq_num
      AND wor.uom_code IN ('DAY')
      and basis_type in (1)
      and activity_id in (1)
      UNION
      select distinct BD.DEPARTMENT_CODE Dept_Name, BD.DESCRIPTION Dept_Description,  WE.WIP_ENTITY_NAME Job_Name, dj.lot_number, dj.MPS_SCHEDULED_COMPLETION_DATE,
             WO.FIRST_UNIT_START_DATE as Sched_Op_Start_Date,
             WO.LAST_UNIT_COMPLETION_DATE as Sched_Op_Completion_Date,
             i.inventory_item AS PART#, i.DESCRIPTION Item_Description, WO.OPERATION_SEQ_NUM Op_Seq,
             WO.DESCRIPTION OP_Description, WO.SCHEDULED_QUANTITY Quantity_Scheduled, 
             WO.QUANTITY_IN_QUEUE Quantity_In_Queue, WO.QUANTITY_COMPLETED,
             NULL AS usage_rate_or_amount, NULL AS applied_resource_units, wo.wip_entity_id
            from apps.WIP_OPERATIONS wo, BOM_DEPARTMENTS BD, WIP_DISCRETE_JOBS DJ,
                 WIP_ENTITIES WE, invfg_items i    
            where WO.ORGANIZATION_ID = 82
            and DJ.ORGANIZATION_ID = 82
            AND WE.ORGANIZATION_ID = 82
            AND i.ORGANIZATION_ID = 82
            AND BD.ORGANIZATION_ID = 82
            AND BD.DEPARTMENT_ID = WO.DEPARTMENT_ID
            AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
            AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
            AND WE.ENTITY_TYPE = 1
          and dj.status_type = 3
            AND wo.wip_entity_id = dj.wip_entity_id
            and wo.operation_seq_num between 1 and 10
            and wo.quantity_in_queue > 0
            and wo.operation_seq_num NOT IN (select distinct operation_seq_num from wip_operation_resources
                                         where wip_entity_id = wo.wip_entity_id
                                         and operation_seq_num between 1 and 10)
            order by 1
    ) a,
    ( -- this inline view gets the denominator value
        select b.Job_Name, b.WIP_ENTITY_ID, xxknc_critical_ratio_den (b.wip_entity_id) as denominator
        from
        select a.Job_Name, a.WIP_ENTITY_ID,
               sum(a.usage_rate_or_amount) as usage_rate_or_amount
        from
         select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name, wor.usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
          from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
               ,WIP_ENTITIES WE, invfg_items i
          where WO.ORGANIZATION_ID = 82
          and DJ.ORGANIZATION_ID = 82
          AND WE.ORGANIZATION_ID = 82
          AND i.ORGANIZATION_ID = 82
          AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
          AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
          AND WE.ENTITY_TYPE = 1
          and dj.status_type = 3
          AND wo.wip_entity_id = dj.wip_entity_id
          AND wor.wip_entity_id = wo.wip_entity_id
          AND wor.operation_seq_num = wo.operation_seq_num
          AND wor.uom_code IN ('HR')
          and basis_type in (2)
          and activity_id in (4,1000)
          UNION
          select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name,
                (wor.usage_rate_or_amount * WO.QUANTITY_COMPLETED) as usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
          from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
               ,WIP_ENTITIES WE, invfg_items i
          where WO.ORGANIZATION_ID = 82
          and DJ.ORGANIZATION_ID = 82
          AND WE.ORGANIZATION_ID = 82
          AND i.ORGANIZATION_ID = 82
          AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
          AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
          AND WE.ENTITY_TYPE = 1
          and dj.status_type = 3
          AND wo.wip_entity_id = dj.wip_entity_id
          AND wor.wip_entity_id = wo.wip_entity_id
          AND wor.operation_seq_num = wo.operation_seq_num
          AND wor.uom_code IN ('HR')
          and basis_type in (1)
          and activity_id in (1)
          UNION
          select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name,
                (wor.usage_rate_or_amount * 24) as usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
          from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
               ,WIP_ENTITIES WE, invfg_items i
          where WO.ORGANIZATION_ID = 82
          and DJ.ORGANIZATION_ID = 82
          AND WE.ORGANIZATION_ID = 82
          AND i.ORGANIZATION_ID = 82
          AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
          AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
          AND WE.ENTITY_TYPE = 1
          and dj.status_type = 3
          AND wo.wip_entity_id = dj.wip_entity_id
          AND wor.wip_entity_id = wo.wip_entity_id
          AND wor.operation_seq_num = wo.operation_seq_num
          AND wor.uom_code IN ('DAY')
          and basis_type in (2)
          and activity_id in (4,1000)
          UNION
          select distinct WE.WIP_ENTITY_ID, WE.WIP_ENTITY_NAME Job_Name,
                ((wor.usage_rate_or_amount * 24) * WO.QUANTITY_COMPLETED) as usage_rate_or_amount, WO.LAST_UNIT_COMPLETION_DATE
          from apps.WIP_OPERATIONS wo, wip_operation_resources wor, WIP_DISCRETE_JOBS DJ
              ,WIP_ENTITIES WE, invfg_items i
          where WO.ORGANIZATION_ID = 82
          and DJ.ORGANIZATION_ID = 82
          AND WE.ORGANIZATION_ID = 82
          AND i.ORGANIZATION_ID = 82
          AND i.inventory_item_id = WE.PRIMARY_ITEM_ID
          AND WO.WIP_ENTITY_ID = WE.WIP_ENTITY_ID
          AND WE.ENTITY_TYPE = 1
          and dj.status_type = 3
          AND wo.wip_entity_id = dj.wip_entity_id
          AND wor.wip_entity_id = wo.wip_entity_id
          AND wor.operation_seq_num = wo.operation_seq_num
          AND wor.uom_code IN ('DAY')
          and basis_type in (1)
          and activity_id in (1)
          order by 1
        ) a
        group by a.WIP_ENTITY_ID, a.Job_Name
        ) b
        order by 1
        ) den
    where a.wip_entity_id = den.wip_entity_id
    ORDER BY a.Job_Name
    ) cr
    where upper(cr.Dept_Name) between nvl(upper(:S_DEPT), upper(cr.Dept_Name)) and nvl(upper(:E_DEPT),upper(cr.Dept_Name))
    and &pwhereclause
    order by 1,3,6,8
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReport" source="xxknc_qty_in_queue.BeforeReportTrigger(:P_QTY_IN_QUEUE)" />
    <dataStructure>
    <group name="G_DEPT_NAME" source="MAIN_Q1">
    <element name="Dept_Name" value="DEPT_NAME" />
    <element name="DEPT_DESCRIPTION" value="DEPT_DESCRIPTION" />
    <element name="LOT_NUMBER" value="LOT_NUMBER" />
    <element name="QUANTITY_SCHEDULED" value="QUANTITY_SCHEDULED" />
    <element name="CRITICAL_RATIO" value="CRITICAL_RATIO" />
    <element name="SCHED_OP_START_DATE" value="SCHED_OP_START_DATE" />
    <element name="SCHED_OP_COMPLETION_DATE" value="SCHED_OP_COMPLETION_DATE" />
    <element name="JOB_COMP_DATE" value="JOB_COMP_DATE" />
    <element name="JOB_NAME" value="JOB_NAME" />
    <element name="ITEM" value="ITEM" />
    <element name="ITEM_DESCRIPTION" value="ITEM_DESCRIPTION" />
    <element name="OPER" value="OPER" />
    <element name="OPER_DESCRIPTION" value="OPER_DESCRIPTION" />
    <element name="QUANTITY_IN_QUEUE" value="QUANTITY_IN_QUEUE" />
    <element name="QUANTITY_COMPLETED" value="QUANTITY_COMPLETED" />
    <element name="CF_ROWNUMFORMULA" value="CF_ROWNUMFORMULA" />
    <element name="S_DEPT" value="S_DEPT" />
    <element name="E_DEPT" value="E_DEPT" />
    <element name="P_QTY_IN_QUEUE" value="P_QTY_IN_QUEUE" />
    </group>
    </dataStructure>
    </dataTemplate>
    create or replace package xxknc_qty_in_queue is
    P_QTY_IN_QUEUE varchar2(100);
    pwhereclause varchar2(1000);
    function BeforeReportTrigger(p_qty_in_queue IN varchar2) return boolean;
    function CF_RowNumFormula return number;
    end xxknc_qty_in_queue;
    create or replace package body xxknc_qty_in_queue as
    function BeforeReportTrigger(p_qty_in_queue IN varchar2) return boolean
    is
    begin
    pwhereclause := 'x';
    if(upper(P_QTY_IN_QUEUE) = 'YES') then
         pwhereclause := 'cr.Quantity_In_Queue > 0';
    elsif (upper(P_QTY_IN_QUEUE) = 'NO') then
         pwhereclause := 'cr.Quantity_In_Queue = 0';
    else
         pwhereclause := '1=1';      
    end if;
    return (TRUE);
    end BeforeReportTrigger;
    function CF_RowNumFormula return Number
    is
    vCount number;
    begin
         vCount := 0;
         vCount:=apps.XXKNC_SHIP_OUTLOOK_REPORT;
         if (mod(vCount,2) = 0) then
              return 1;
    else
    return 0;
    end if;
    end CF_RowNumFormula;
    end xxknc_qty_in_queue;
    Custom Application: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXKNC_WIPDJCR_DEF module: XXKNC_WIP_XML_Data_Template
    Current system time is 20-JUL-2009 08:24:12
    XDO Data Engine Version No: 5.6.3
    Resp: 20420
    Org ID : 81
    Request ID: 3370019
    All Parameters: S_DEPT=ADMIN:E_DEPT=INSP:P_QTY_IN_QUEUE=YES:CP_QTY_IN_QUEUE=YES
    Data Template Code: XXKNC_WIPDJCR_DEF
    Data Template Application Short Name: CUSTOM
    Debug Flag: N
    {E_DEPT=INSP, S_DEPT=ADMIN, CP_QTY_IN_QUEUE=YES, P_QTY_IN_QUEUE=YES}
    Calling XDO Data Engine...
    [072009_082414567][][ERROR] Variable 'pwhereclause' is missing....
    [072009_082414616][][EXCEPTION] java.sql.SQLException: ORA-06550: line 2, column 18:
    PLS-00103: Encountered the symbol "." when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternatively-quoted S
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1119)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2191)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2064)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2989)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:736)
         at oracle.apps.xdo.dataengine.DataTemplateParser.getRemoteValue(DataTemplateParser.java:1756)
         at oracle.apps.xdo.dataengine.DataTemplateParser.getSubstituteObject(DataTemplateParser.java:1583)
         at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1404)
         at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:440)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:429)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:300)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    --SQLException
    java.sql.SQLException: ORA-00920: invalid relational operator
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:590)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1973)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:850)
         at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2599)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2963)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:658)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:584)
         at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:515)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:429)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:300)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Executing request completion options...
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 20-JUL-2009 08:24:14
    ---------------------------------------------------------------------------

    Misra, I noticed that I misspelled my pwhereclaus parameter so I went back and corrected it. When I executed the data template I got a new error. Can you tell me what this error means or how to fix this?
    Custom Application: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXKNC_WIPDJCR_DEF module: XXKNC_WIP_XML_Data_Template
    Current system time is 20-JUL-2009 11:40:07
    XDO Data Engine Version No: 5.6.3
    Resp: 20420
    Org ID : 81
    Request ID: 3370253
    All Parameters: S_DEPT=ADMIN:E_DEPT=BIO:P_QTY_IN_QUEUE=YES:CP_QTY_IN_QUEUE=YES
    Data Template Code: XXKNC_WIPDJCR_DEF
    Data Template Application Short Name: CUSTOM
    Debug Flag: N
    {E_DEPT=BIO, S_DEPT=ADMIN, CP_QTY_IN_QUEUE=YES, P_QTY_IN_QUEUE=YES}
    Calling XDO Data Engine...
    java.lang.NullPointerException
         at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1695)
         at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1414)
         at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:440)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:429)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:300)
         at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:266)
         at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:205)
         at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:237)
         at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:364)
         at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:236)
         at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:161)
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Executing request completion options...
    Finished executing request completion options.
    Concurrent request completed
    Current system time is 20-JUL-2009 11:40:09
    ---------------------------------------------------------------------------

  • How to implement place holder columns in data template

    Hi,
    I have a requirement where I have to mimic the functionality of place holder columns in RDF using Data Templates in XML Publisher.
    How can I call a pl/sql function at element level when we try to group records in the data template.
    To make it simple , let us say I have a requirement to retrieve the address of an employee(address line 1,address line 2, city,country)
    In RDF what I do is define 4 place holder columns to capture address attributes, and in a formula column I set values to these attributes. How do I implement this in XML Publisher data template.
    When I tried to implement the above requirement using test variables, I was able to execute a pl/sql function after the group tag, but not within the group tag.
    I got the result for calc_values3 , but didn;t get anythng for calc_values1 and 2
    Data Template:
    <dataTemplate name="XXLCPAY142R" description="online payslip" defaultPackage="XXLCPAY_ONLINEPAYSLIP_PKG" version="1.0">
    <parameters>
    <parameter name="P_ASSIGNMENT_ACTION_ID" dataType="number" />
    </parameters>
    <dataQuery>
    <sqlStatement name="Q_PAYMENT_RUN">
    <![CDATA[
    SELECT PAAPRV.assignment_action_id assignment_action_id
    ,PAAPRV.payroll_action_id payroll_action_id
    ,PAAPRV.run_assignment_action_id run_assignment_action_id
    ,PAAPRV.run_payroll_action_id run_payroll_action_id
    ,PAAPRV.person_id person_id
    ,PAAPRV.full_name full_name
    ,PAAPRV.last_name surname
    ,PAAPRV.assignment_id assignment_id
    ,PAAPRV.business_group_id business_group_id
    ,PAAPRV.assignment_number assignment_number
    ,PAAPRV.registered_employer legal_employer
    ,PAAPRV.abn abn
    ,PAAPRV.grade grade
    ,PAAPRV.payroll_id payroll_id
    ,PAAPRV.time_period_id time_period_id
    ,PAAPRV.period_start_date period_start_date
    ,PAAPRV.period_end_date period_end_date
    ,TO_CHAR(PAAPRV.period_start_date,'DD-Mon-YYYY') period_start_display
    ,TO_CHAR(PAAPRV.period_end_date,'DD-Mon-YYYY') period_end_display
    ,PAAPRV.period_number || ' ' || TO_CHAR(PAAPRV.period_end_date,'YYYY') period_number
    ,TO_CHAR(PTP.regular_payment_date,'DD-Mon-YYYY') pay_date
    ,PAAPRV.date_earned date_earned
    ,PAAF.ass_attribute2 legacy_position
    ,HR_GENERAL.DECODE_LOOKUP('EMPLOYEE_CATG',PAAF.employee_category) paypoint
    ,PPB.name salary_basis
    ,PAAF.people_group_id people_group_id
    ,PAAF.collective_agreement_id cagr_id
    FROM pay_au_asg_payment_runs_v PAAPRV
    ,per_time_periods PTP
    ,per_all_assignments_f PAAF
    ,per_pay_bases PPB
    WHERE PAAPRV.time_period_id = PTP.time_period_id
    AND PAAPRV.assignment_id = PAAF.assignment_id
    AND PAAF.pay_basis_id = PPB.pay_basis_id
    AND PAAPRV.date_earned BETWEEN PAAF.effective_start_date AND PAAF.effective_end_date
    AND PAAPRV.assignment_action_id = :P_ASSIGNMENT_ACTION_ID
    ]]>
    </sqlStatement>
    <sqlStatement name="Q_EARNINGS_DEDUCTIONS">
    <![CDATA[
    SELECT PAI.locking_action_id assignment_action_id_elements
         ,PRR.assignment_action_id assignment_action_id_run_ele
         ,PRR.run_result_id run_result_id
         ,PPA.effective_date effective_date_run
         ,PAAF.pay_basis_id pay_basis_id
         ,PETF.element_type_id element_type_id_ele
         ,NVL(PETF.reporting_name
         ,PETF.element_name) element_name_ear_ded
         ,PIVF.input_value_id input_value_id
         ,PEC.classification_name classification_name
         ,PRRV.result_value amount_elements
         ,DECODE( PEC.classification_name
         , 'Earnings' , 1
         ,'Pre Tax Deductions' , 2
         ,'Involuntary Deductions' , 3
         ,'Voluntary Deductions' , 3 ) sort_order_elements
         ,CASE NVL(PETF.reporting_name
         ,PETF.element_name)
         WHEN 'Salary' THEN 1
         ELSE 2
         END sort_order_name
         ,DECODE( PEC.classification_name
         ,'Earnings',1
         ,0
         ) earnings_count
         ,DECODE( PEC.classification_name
         ,'Earnings',0
         ,1
         ) deductions_count     
         FROM pay_action_interlocks PAI
         ,pay_assignment_actions PAA
         ,pay_payroll_actions PPA
         ,per_all_assignments_f PAAF
         ,pay_run_results PRR
         ,pay_run_result_values PRRV
         ,pay_input_values_f PIVF
         ,pay_element_types_f PETF
         ,pay_element_classifications PEC
         WHERE PAI.locked_action_id = PAA.assignment_action_id
         AND PAA.payroll_action_id = PPA.payroll_action_id
         AND PAA.assignment_id = PAAF.assignment_id
         AND PAA.assignment_action_id = PRR.assignment_action_id
         AND PRR.run_result_id = PRRV.run_result_id
         AND PRRV.input_value_id = PIVF.input_value_id
         AND PRR.element_type_id = PETF.element_type_id
         AND PETF.classification_id = PEC.classification_id
         AND PPA.effective_date BETWEEN PAAF.effective_start_date AND PAAF.effective_end_date
         AND PPA.effective_date BETWEEN PETF.effective_start_date AND PETF.effective_end_date
         AND PPA.effective_date BETWEEN PIVF.effective_start_date AND PIVF.effective_end_date
         AND PPA.action_type IN ( 'R','Q' )
         AND PRR.status IN ('P','PA')
         AND PEC.classification_name IN ( 'Earnings'
         ,'Pre Tax Deductions'
         ,'Involuntary Deductions'
         ,'Voluntary Deductions')
         AND PIVF.name = 'Pay Value'
         AND PAI.locking_action_id = :assignment_action_id
         ORDER BY sort_order_elements ASC, sort_order_name ASC
    ]]>
    </sqlStatement>
    </dataQuery>
    <dataTrigger name="beforeReport" source="XXLCPAY_ONLINEPAYSLIP_PKG.BEFORE_REPORT" />
    <dataStructure>
    <group name="G_PAYMENT_RUN" source="Q_PAYMENT_RUN">
    <element name="assignment_action_id" value="assignment_action_id"/>
    <element name="payroll_action_id" value="payroll_action_id"/>
    <element name="run_assignment_action_id" value="run_assignment_action_id"/>
    <element name="run_payroll_action_id" value="run_payroll_action_id"/>
    <element name="person_id" value="person_id"/>
    <element name="full_name" value="full_name"/>
    <element name="surname" value="surname"/>
    <element name="assignment_id" value="assignment_id"/>
    <element name="business_group_id" value="business_group_id"/>
    <element name="assignment_number" value="assignment_number"/>
    <element name="legal_employer" value="legal_employer"/>
    <element name="abn" value="abn"/>
    <element name="grade" value="grade"/>
    <element name="payroll_id" value="payroll_id"/>
    <element name="time_period_id" value="time_period_id"/>
    <element name="period_start_date" value="period_start_date"/>
    <element name="period_end_date" value="period_end_date"/>
    <element name="period_start_display" value="period_start_display"/>
    <element name="period_end_display" value="period_end_display"/>
    <element name="period_number" value="period_number"/>
    <element name="pay_date" value="pay_date"/>
    <element name="date_earned" value="date_earned"/>
    <element name="legacy_position" value="legacy_position"/>
    <element name="paypoint" value="paypoint"/>
    <element name="salary_basis" value="salary_basis"/>
    <element name="people_group_id" value="people_group_id"/>
    <element name="cagr_id" value="cagr_id"/>
    <group name="G_EARNINGS_DEDUCTIONS" source="Q_EARNINGS_DEDUCTIONS">
    <element name="assignment_action_id_elements" value="assignment_action_id_elements"/>
    <element name="assignment_action_id_run_ele" value="assignment_action_id_run_ele"/>
    <element name="run_result_id" value="run_result_id"/>
    <element name="effective_date_run" value="effective_date_run"/>
    <element name="pay_basis_id" value="pay_basis_id"/>
    <element name="element_type_id" value="element_type_id"/>
    <element name="element_name_ear_ded" value="element_name_ear_ded"/>
    <element name="input_value_id" value="input_value_id"/>
    <element name="classification_name" value="classification_name"/>
    <element name="amount_elements" value="amount_elements"/>
    <element name="sort_order_elements" value="sort_order_elements"/>
    <element name="sort_order_name " value="sort_order_name "/>
    <element name="earnings_count" value="earnings_count"/>
    <element name="deductions_count" value="deductions_count"/>
    <element name="calc_values" value="XXLCPAY_ONLINEPAYSLIP_PKG.CALC_VALUES(67772)"/>
    <element name="calc_values1" value="XXLCPAY_ONLINEPAYSLIP_PKG.RETURN_TEST"/>
    <element name="calc_values2" dataType="number" value="XXLCPAY_ONLINEPAYSLIP_PKG.P_TEST" function="XXLCPAY_ONLINEPAYSLIP_PKG.P_TEST"/>
    </group>
    </group>
    <element name="calc_values3" dataType="number" value="XXLCPAY_ONLINEPAYSLIP_PKG.P_TEST"/>
    </dataStructure>
    </dataTemplate>
    CREATE OR REPLACE PACKAGE XXLCPAY_ONLINEPAYSLIP_PKG
    AS
    P_TEST NUMBER;
    P_ASSIGNMENT_ACTION_ID NUMBER;
    FUNCTION BEFORE_REPORT RETURN BOOLEAN;
    FUNCTION RETURN_TEST RETURN NUMBER;
    FUNCTION RETURN_TEST1 RETURN NUMBER;
    FUNCTION RETURN_TEST2 RETURN NUMBER;
    FUNCTION CALC_VALUES(element_type_id number) RETURN NUMBER;
    END XXLCPAY_ONLINEPAYSLIP_PKG;
    CREATE OR REPLACE PACKAGE BODY XXLCPAY_ONLINEPAYSLIP_PKG
    AS
    P_TEST1 NUMBER;
    P_TEST2 NUMBER;
    FUNCTION BEFORE_REPORT RETURN BOOLEAN
    IS
    BEGIN
    P_TEST := 2;
    FND_FILE.PUT_LINE(FND_FILE.LOG,'From Before Report');
    RETURN(TRUE);
    END BEFORE_REPORT;
    FUNCTION RETURN_TEST RETURN NUMBER
    IS
    BEGIN
    FND_FILE.PUT_LINE(FND_FILE.LOG,'Call 1');
    RETURN(P_TEST);
    END RETURN_TEST;
    FUNCTION CALC_VALUES(element_type_id number) RETURN NUMBER
    IS
    BEGIN
    FND_FILE.PUT_LINE(FND_FILE.LOG,'Call 2');
    p_test1 := null;
    p_test2 := null;
    if ( element_type_id = 67772 ) then
    P_TEST1 := 5;
    P_TEST2 := 7;
    elsif (element_type_id = 67804 ) then
    P_TEST1 := 9;
    P_TEST2 := 11;
    end if;
    RETURN(1);
    END CALC_VALUES;
    FUNCTION RETURN_TEST1 RETURN NUMBER
    IS
    BEGIN
    RETURN(P_TEST1);
    END RETURN_TEST1;
    FUNCTION RETURN_TEST2 RETURN NUMBER
    IS
    BEGIN
    RETURN(P_TEST2);
    END RETURN_TEST2;
    END XXLCPAY_ONLINEPAYSLIP_PKG;
    /

    For this, you need to have a master query and child query.
    1) In your master query you will have to identify one unique column and call a pl/sql pkg function which calculates all values for your place holder columns and inserts rows into a pl/sql table with the index as your unique column
    ex: Master query returns
    empnum name amount
    1 scott 250
    2 bob 350
    and your calculated value is 10 percent of the amount
    your pl/sql pkg should insert records into the pl/sql table like r(1):= 250*0.1 = 25 r(2):= 350*0.1 = 35
    2) The child query will get executed for each row of you rmaster query, so you should be able to read the values based on which master records row it is executing for
    Please bear in mind that you have to make sure that the report is not executed by two different people at the same time, else you have to consider session or any other unique identifier in addition to your master records unique identifier.
    Cheers,
    Girish.

  • 'Order by' in a parameter - in AfterPForm trigger..? in a Data template..?

    Arrrfternoon all.
    As title confusingly asks.. Has anybody put an 'order by' parameter into their data template either by the use of a trigger or by some other way..?
    As one or two have may have guessed by now, I'm a newbie to BIP with no training but am learning fast..
    In ORACLE Reports 6i I'd stick the order by in the select statement, named it in the Conc Program 'token' and have the details that the user can choose from (if...then...else'd..) in the AfterpForm section.
    If the above still applies (and from the example data templates I've seen - it does) then all I do is call the AfterPForm trigger in the data template BUT, where do I write and place the actual PForm trigger (that includes the if orderby = 'empname' ...then..)..?
    thanks for reading..
    Steven

    OK, I've now created my data template that includes a reference to the trigger.
    I've also created my package Header and Body - but the question still remains.. How do I now include the Package Header & Body when the Data Template is being run..? How is it referenced? If I just run this data template in my BIP'd Concurrent Program surely it'll just say 'whats the trigger you've mentioned - where is it..?'
    Basically, I don't how this hangs together at all. Can someone please help me out here?
    Many Thanks for looking..
    Steven

  • Calling a package function inside a sql

    Hi friends!!!
    First of all happy Christmas! And them please help! :)
    We have a query calling a package function:
    SELECT * FROM DW025H WHERE DW025H_NR=MPPCI.ENCR ('0000000000000000');There is a primary key just with one column DW025H_NR and the problem is that is not accessing by INDEX UNIQUE SCAN,
    it's accessing by TABLE ACCESS FULL.
    May be the problem is that we are calling a procedure inside the query?
    I have been able to run that query accessing by primary key from my computer but a workmate hasn't!
    We both are connecting the same data base 10.2.0.4 and using Oracle SQL Developer!
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 5343K| 1406M| 15670 (7)| 00:02:43 |
    |* 1 | VIEW | DW025H | 5343K| 1406M| 15670 (7)| 00:02:43 |
    |* 2 | FILTER | | | | | |
    | 3 | TABLE ACCESS FULL| DW025H | 5343K| 1406M| 15670 (7)| 00:02:43 |
    Predicate Information (identified by operation id):
    1 - filter("DW025H_NR"="MPPCI"."ENCRIPTAPAN"('0000000000000000'))
    2 - filter(CASE "OPS$SISINFO"."IS_USER_DNI"() WHEN 1 THEN
    SYS_AUDIT('OPS$SISINFO','DW025H','CMINFOGR001',3) ELSE NULL END IS
    NULL)
    The correct path would be:
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 276 | 3 (0)| 00:00:01 |
    |* 1 | FILTER | | | | | |
    | 2 | TABLE ACCESS BY INDEX ROWID| DW025H | 1 | 276 | 3 (0)| 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | PK_DW025H | 1 | | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(CASE "OPS$SISINFO"."IS_USER_DNI"() WHEN 1 THEN
    SYS_AUDIT('OPS$SISINFO','DW025H ','CMINFOGR001',3) ELSE NULL END IS NULL)
    3 - access("DW025H_NR"="MPPCI"."ENCR"('0000000000000000'))
    Please any ideas!?!?!
    Thanks a lot!
    José
    Edited by: jamv on Dec 20, 2011 10:50 AM

    Hello
    Have a read of this and try to pull together the information in it and post it up here. That will help immensely with getting to the root of your problem...
    HOW TO: Post a SQL statement tuning request - template posting
    In the mean time:
    From the execution plan you have extra predicates that aren't present in the query you supplied, so that's either not the SQL or you have something like VPD switched on.
    Anyway, there could be lots of reasons for the difference in execution plan. Sorry if this is very basic and possibly patronising question but it's always worth checking the basics I think - are you both definitely connecting to the same database? If so, have a look in v$sqlarea for this SQL statement and find the SQL_ID, use this to query v$sql and look at the child_number column.
    select
        sql_id
    from
        v$sqlarea
    where
        sql_text like '%SELECT * FROM DW025H WHERE DW025H_NR=MPPCI.ENCR%(''0000000000000000'')%'
    and
        sql_text not like '%v$sqlarea%'
    select child_number from v$sql where sql_id='<enter the sql id returned by the query above>'as an example...
    XXXX> select /* my sql statement*/ rownum id from dual;
            ID
             1
    1 row selected.
    Elapsed: 00:00:00.10
    XXXX> select sql_id from v$sqlarea where sql_text like '%my sql statement%'
    and sql_text not like '%v$sqlarea%';
    SQL_ID
    a6ss4v79udz6g
    1 row selected.
    Elapsed: 00:00:03.56
    XXXX> select child_number from v$sql where sql_id='a6ss4v79udz6g'
      2  /
    CHILD_NUMBER
               0
    1 row selected.   If you have more than one row in v$sql there could be differences in the optimiser environment. The supplied like shows you how to gather the information that should help find what the differences are if any.
    Also as a side note if you're calling PL/SQL functions from SQL, you can take advantage of subquery caching to help reduce the number of calls (depending on your version). As it stands, your function is most likely going to be called for every row - when there is only a single row returned, that's not necessarily a problem but for multiple rows, the overhead can quickly grow. If there's no way to get rid of the function call, select the function from dual instead i.e.
    SELECT * FROM DW025H WHERE DW025H_NR= (SELECT MPPCI.ENCR%('0000000000000000') FROM dual);This also (as I learnt a couple of weeks ago) works when you're using columns in the table your selecting from as parameters to the function.
    HTH
    David

  • Syntax of formula column in data template

    Hi All,
    I am trying to generate XML output from Data Template. But I am struggling with how to implement formula column. I am using this syntax. But it is not working. Please anybody send me working formula column syntax.
    <element name="PO_NUMBER" value="PO_NUMBER" />
    <function name="CF_DUMMY" dataType="number" >
    <textSource>
    <! [CDATA [
    function CF_DUMMY return number is
    begin
    return 3;
    end;
    ]]>
    </textSource>
    </function>
    </group>

    The call is done directly in the query.
    In your Template header you can reference the database package to use this for example for triggers in your template:
    <dataTemplate .... defaultPackage="myPackage" ...>
    Then your Query looks like
    <sqlStatement name="Q_2">
    <![CDATA[select empno,ename,myPackage.cf_myformula(sal, comm) as Income from emp WHERE deptno=:abeilung]]>
    </sqlStatement>
    In your dataStructure Section you than can reference the formula like any other column
    <element name="INCOME" dataType="number" value="INCOME"/>
    Additionaly you can have triggers like before report trigger, where the logic is in the same database package:
    <dataTrigger name="beforeReport" source="myPackage.beforeRepLogic"/>
    Regards
    Rainer

  • FUNCTION Variable within Data Template

    Hi Im calling a function within my sql and i want to use the result as a bind variable.... here goes...
    Data Template...... XML
    <sqlStatement name="Q1">
    <![CDATA[select function_name(ppp.id) the_main_one,
    :the_main_one + 10 new_value
    from per_ppp]]>
    </sqlStatement>
    I get null value .... but from the_main_one i get a value..... any ideas... i checked for number and nvl(,0) and all that no luck
    is there a grouping thing involved here... where as i need to call the function from within another sql statement...

    It can be done.
    Step 1: Setup package.
    Step 2: Create a global variable for your function value
    Step 3: Before the calling function returns the value, set a global variable (placeholder)
    Step 4: Create a new function that returns the global variable, make sure it's after the first function call. Returning the value you might want to reset the global variable to null....
    Your good to go.
    Ike Wiggins
    http://bipublisher.blogspot.com

Maybe you are looking for

  • Powerbook Printing to a WinXP PC with Shared printer issue

    I've recently made the switch for my laptop to a Powerbook G4 and am very very happy with it. There is only one thing that I cannot seem to get working though. I have a Canon i950 Photo Printer hooked up to my desktop XP machine via USB and have it s

  • Is there any one in HP that pays any attention to the customer?

    I have had numerous PC's and laptops in my work and at home and have bought HP products for the last 20 years, but that is about to change.  I recently had an issuewith the sound or lack of it on my PC. I could get sound from CD's but not the interne

  • Extractor configuration step by step

    I all, where can I find a step by step guide about the BI extractor configuration to transfer data from SAP HR  to SAP BI? Thanks

  • Messages app crashes

    when I try touch one of the bubbles in order to delete a single text

  • Tethered Camera Support for Nikon D3200

    I need to shoot in tethered capture mode and have found that my D90 in not fully supported in this mode.  A D7000 is fully supported, but will cost somewhat more than I had hoped to spend.  The new D3200 would be an excellent match for our needs (den