Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Sunday, 15 December 2013

BI Publisher Interview questions and Answers

Q)What is a Data Template?

The Oracle XML Publisher data engine enables you to rapidly generate any kind of XML data structure against any database in a scalable, efficient manner. The data template is the method by which you communicate your request for data to the data engine. It is an XML document whose elements collectively define how the data engine will process the template to generate the XML.

Q)What Functionality is Supported?

The data engine supports the following functionality:
       Schema generation
       Default RTF template generation
       Flexfields
       Single and multiple data queries
       Query links
       Parameters
       Aggregate functions (SUM, AVG, MIN, MAX, COUNT)
       Event triggers
       Multiple data groups
       Unicode for XML Output
                Unicode is a global character set that allows multilingual text to be displayed in a single application. This enables you to develop a single multilingual application and deploy it worldwide.
       Canonical format
                The data engine generates date elements using the canonical ISO date format: YYYY-MM-DDTHH24:MI:SS.FF3TZH:TZM for a mapped date element, and ######.## for number elements in the data template XML output.
How to Design the Data Template Definition
<data Template name=”data Template name” description=”Template description” default Package = “XX” version =”1.0”>
<parameters>
      <parameter name =”xx” dataType =”character/date/number” default Value=”10”/>
</parameters>
<lexicals>
</lexicals>
<dataQuery>
  <sqlStatement name=”Q1_XX”>
          Put your Select ename from emp
</ sqlStatement >
<data Trigger name=”before Report” source=”package name.beforeReportTrigger”/>
<dataStructure>
  </dataStructure>
<group name=”G_name” source=”Q1_XX”>
<element name=”ename” source=”ENAME” datatype=”varchar2”/>
</group>
</dataQuery>
</data Template>

Q) How to link the Queries in BI publishers reports ?
Ans) link the SQL operator that defines the parent-child relationship
<link name =”Q1_link” parentQuery=”Q1” parentColumn=”depno” childQuery=”Q2” childColumn=”depno”/>

Q)  Data Template using Link
Using Link tag
<dataQuery>
<sqlStatement name="Q1">
   <![CDATA[
            SELECT DEPTNO,DNAME,LOC from dept where &pwhereclause
            order by deptno    ]]>
   </sqlStatement>
  <sqlStatement name="Q2">
 <![CDATA[
            SELECT  EMPNO,ENAME,JOB,MGR,HIREDATE,SAL
                     from EMP ]]>
  </sqlStatement>
 <link name="DEPTEMP_LINK" parentQuery="Q1" parentColumn="DEPTNO" childQuery="Q2" childColumn=“DEPTNO“condition="="/>
  </dataQuery>

Q) Data template Passing parameter
<parameters>
    <parameter name="p_DeptNo" dataType="character" />
 </parameters>
 <dataQuery>
   <sqlStatement name="Q1">
   <![CDATA[
       SELECT d.DEPTNO,d.DNAME,d.LOC,
              EMPNO,ENAME,JOB,MGR,HIREDATE,SAL
                                 from dept d, emp e
        where d.deptno=e.deptno
        AND d.deptno = nvl(:p_DeptNo,d.deptno)  ]]>
  </sqlStatement>
  </dataQuery>

Q) Using Triggers in Data Template

Data Triggers
Data Triggers can be used 
              Perform initialization tasks
              Allows to build dynamic  query
Data Triggers Types
              beforeReport trigger: Fires before the dataQuery is executed .
              afterReport   trigger  : Fires after you exit and after XML output has been generated
Example :-
<dataTrigger name="beforeReport" source="employee.beforeReport()"/>
<dataTrigger name="beforeReport" source="employee.beforeReport(:Parameter)"/>


Q) Using Flex Fields in Data Demplate
              Flexfield aware
              Support all Flexfield features
             
      KFF related lexicals
•              oracle.apps.fnd.flex.kff.segments_metadata
•              oracle.apps.fnd.flex.kff.select
•              oracle.apps.fnd.flex.kff.where
•              oracle.apps.fnd.flex.kff.order_by


Example: Flexfield Query

<dataTemplate ...
      <parameters ...
      </parameters>
<lexicals>
        <lexical
           type="oracle.apps.fnd.flex.kff.select"
           name="FLEX_VALUE_ALL"
           comment="Comment"
           application_short_name="SQLGL"
           id_flex_code="GL#"
           id_flex_num=":P_ID_FLEX_NUM"
           multiple_id_flex_num="N"
           code_combination_table_alias="gcc"
           segments="ALL"
           show_parent_segments="Y"
           output_type="VALUE"
        />
</lexicals>

How to Prevent Excel from suppressing leading zeros

<fo:bidi-override direction="ltr" unicode-bidi="bidi-override">
<?XML_ELEMENT?>
</fo:bidi-override>
How to create Summary Columns in Data Template ?A summary column performs a computation on another column's data. Using the function attribute of the <element> tag, you can create the following summaries: sum, average, count, minimum, and maximum.


<group name="G_DEPT" source="Q1" groupFilter="empdata.G_EMPFilter(:DEPTSAL)">   
<element name="DEPT_NUMBER" value="DEPTNO"  />   
<element name="DEPT_NAME"   value="DNAME"/>   
<element name="DEPTSAL"     value="G_EMP.SALARY" function="SUM()"/>
<group name="G_EMP" source="Q1">   
<element name="DEPT_NUMBER" value="DEPTNO"  />   
<element name="DEPTSAL" value="G_DEPT.SALARY" function="SUM()"/>       
<group name="G_EMP" source="Q2">          
<element name="EMPLOYEE_NUMBER" value="EMPNO" />          
<element name="NAME" value="ENAME"/>          
<element name="JOB" value="JOB" />          
<element name="SALARY" value="SAL"/>       
 </group>
 </group>

Q) How to use the lexicla Paramters in Data Templates ?

in ur select statement where &whereaswrite the on package in like below  

 CREATE OR REPLACE PACKAGE BI_SQL 

 ASapproved VARCHAR2(10);

 buyer varchar2(50);

 po_to number;

 po_from number;

 p_blanket varchar(10);

 whereas varchar2(1000);

 function po_num return boolean ;

 end;

 

CREATE OR REPLACE PACKAGE body BI_SQL 

AS

function po_numreturn boolean 

AS

begin

WHEREAS := ' ';

If po_from > po_to then

WHEREAS := ' AND to_number(Poh.SEGMENT1) between '||'('||po_to||') and ('||po_from||') ';

---||po_from ||' AND '|| po_to;elseWHEREAS := ' AND to_number(Poh.SEGMENT1) between '||'('||po_from||') and ('||po_to||') '; 

end if;

return true; 

end;

END;/

call this package through

 before report trigger <dataTrigger name="beforeReport" source="BI_SQL.po_num"/>


How to Prevent Excel from suppressing leading zeros

<fo:bidi-override direction="ltr" unicode-bidi="bidi-override"><?XML_ELEMENT?></fo:bidi-override>


Drop me a comment if have any doubts and questions.........

Friday, 5 October 2012

XML Publisher Interview Questions and Answers


1.     What are the XML publisher tables.
Ans>PER_GB_XDO_TEMPLATES
XDO_DS_DEFINITIONS_B
XDO_DS_DEFINITIONS_TL
XDO_DS_DEFINITIONS_VL
XDO_LOBS
XDO_TEMPLATES_B
XDO_TEMPLATES_TL
XDO_TEMPLATES_VL
XDO_TEMPLATE_FIELDS
XDO_TRANS_UNITS
XDO_TRANS_UNIT_PROPS
XDO_TRANS_UNIT_VALUES
2.     how to create report with out .rdf?
Ans> Using Data template…..see below link
3.     how to write a loop in rtf template design ?
Ans> <?for-each:G_invoice_no?>
     ……………………..<?end for each?>
4.     how to design  sub templates in rtf layout ?
Ans> using following tags..
                <?template:template_name?>
                      This is Last Page
                               <?end template?>
5.     how to call a header or footer ?
          Ans> using this tag <?call:header?> and <?call:footer?>
                We have to use header section and footer section of the page.

6.     How to break the page in specific condition ?
Ans>  <?split-by-page-break:?>
7.     How to use section break ?
Ans>  <?for-each@section:G_CUSTOMER(This is group name)?>
8.     How to create multi layouts in XMLP ?
        Ans>  using below conditions
               <?choose:?>
               <?when:CF_CHOICE=’VENDOR’?>
            Your template….
               <?end when?>
                   <?when:CF_CHOICE=’INVOICE’?>
                Your template….
              <?end when?>
                           <?when:CF_CHOICE=’RECEIPT’?>
                              Your template….
                    <?end when?>
                                              <?end choose?>
9.     How to calculate the running total in XMLP?
Ans>           <?xdoxslt:set_variable($_XDOCTX, 'RTotVar', xdoxslt:get_variable($_XDOCTX, 'RTotVar') + ACCTD_AMT(This is                                                column name) )?><?xdoxslt:get_variable($_XDOCTX, 'RTotVar')?>
10.   How to submit a layout in the backend ?
       Ans>  we have to write a procedure for this using the below code
                              fnd_request.add_layout
                             (template_appl_name      => 'application name',
                              template_code           => 'your template code',
                              template_language       => 'En',
                              template_territory      => 'US',
                              output_format           => 'PDF'
                             );
11.   How to display the images in XMLP?
        Ans> url:{'http://image location'}
                 For example, enter:
                   url:{'http://www.oracle.com/images/ora_log.gif'}
                      url:{'${OA_MEDIA}/image name'}
12.   How to pass the page numbers in rtf layout?
Ans>  <REPORT>
<PAGESTART>200<\PAGESTART>
....
</REPORT>
Enter the following in your template:
<?initial-page-number:PAGESTART?>

13.How to display  last page is differently in XML Publisher Reports.

Ans> what you want to dispay the test anything write in last of page

last page header 

<?start@last-page-first:body?>    <?end body?>

more questions i will update soon......... 
 we have any doubts on this please give the comment....i will respond...u r comment



Thursday, 16 August 2012

XML Publisher Tables



Tables:
=======
PER_GB_XDO_TEMPLATES
XDO_DS_DEFINITIONS_B
XDO_DS_DEFINITIONS_TL
XDO_DS_DEFINITIONS_VL
XDO_LOBS
XDO_TEMPLATES_B
XDO_TEMPLATES_TL
XDO_TEMPLATES_VL
XDO_TEMPLATE_FIELDS
XDO_TRANS_UNITS
XDO_TRANS_UNIT_PROPS
XDO_TRANS_UNIT_VALUES

Important: Since the latest release of XML Publisher,
 Applications Object Library (FND) patch 3435480 has been released to fully integrate XML Publisher with the Concurrent Manager.
If you have taken this patch, you no longer have to run the XML Publisher Concurrent Request as a second step

Using Multiple Quires Data Template Code


<dataTemplate name="WOBB" description="Work Order Header and Body " version="1.0" defaultPackage="WO_PKG">
<parameters>
<parameter name ="p_Workorder_From"          dataType="character"/>
</parameters>
<property name="fo-keep-empty-inline">false</property>
<dataQuery>
<sqlStatement name="Q_ReportHeader">
SELECT hp.party_name                                                                                 Company_Name,
         Mp.organization_code                                                                          Comp_Num,
        DECODE (INSTR(mtl.segment1, wsg.schedule_group_name), 0,
                        pjm_project.all_task_idtonum (wdj.task_id)
                        || ' '|| mtl.segment1
                        || wsg.schedule_group_name,pjm_project.all_task_idtonum (wdj.task_id)
                        || mtl.segment1)                                                               Item_Number,
       wsg.schedule_group_name                                                                         Running_Number,
       mtl.description                                                                                 Item_Description,
       we.wip_entity_name                                                                              Work_Order_No,
       mtl.segment1                                                                                    Drawing_No,
       to_char(wdj.scheduled_start_date,'DD-MM-YY HH24:MI')                                            Planned_start_date,
      NVL (pjm_project.all_task_idtoname(wdj.task_id),
           SUBSTR (mtl.segment1, 0, INSTR (mtl.segment1, 'TP') - 1)
           )                                                                                           Internal_Order_name,
       to_char(wdj.scheduled_completion_date ,'DD-MM-YY HH24:MI')                                       Planned_end_date,
       mtl. wip_supply_locator_id || ' '|| mtl.wip_supply_subinventory                                  Raw_material_warehouse,
       wdj.completion_locator_id                                                                       finish_goods_subinv,    
       wdj.start_quantity                                                                               Quantity_ordered,
       mtl.unit_weight || ' '|| mtl.weight_uom_code                                                     Weight,
       wdj.QUANTITY_COMPLETED                                                                           Quantity_completed,
       DECODE(XSRS.PRINT_FLAG_WO_STATUS, 'Duplicate', 'Duplicate', 'Original') wo_status
   FROM wip_discrete_jobs wdj,
        Mtl_parameters mp,
       mtl_system_items_b mtl,
       xle_entity_profiles xep,
       hz_parties hp,
       wip_schedule_groups wsg,
       wip_entities we,
       hr_organization_information hoi,
       XXDIS_SCO_REPORT_STATUS XSRS
WHERE  hp.party_id = xep.party_id
   AND wdj.organization_id = mtl.organization_id
   AND wdj.primary_item_id = mtl.inventory_item_id
   AND wdj.schedule_group_id = wsg.schedule_group_id
   AND wdj.organization_id = wsg.organization_id
  NVL(:p_Workorder_From,we.wip_entity_name)
</sqlStatement>
<sqlStatement name="Q_DATE">
SELECT to_char(sysdate,'DD-MM-YY HH24:MI') sys_date FROM DUAL
</sqlStatement>

<sqlStatement name="Q_DEPT_WC">
SELECT XXDPS_GBL_GENERIC_PKG.XXDPS_GBL_DEPT_FUNC(we.wip_entity_name)  sled_pracovist_workcentre
FROM wip_entities we WHERE we.wip_entity_name=:p_Workorder_From
</sqlStatement>

<sqlStatement name="Q_RoutingHeader">

SELECT    pjm_project.all_task_idtonum (x.parent_task_id)||mtl.segment1
       || wsg.schedule_group_name                                     xx,
       wdjo.start_quantity                                               xxx,                                              
       mtl.description                                                    xxxx,
       weo.wip_entity_name                                                vo_parent_wo_number,
       mfl.meaning                                                        stav_vo_parent_wo_status
       ,SUBSTR (xdis.bom_text, 1, 20)                                     Quality_Plan_Identification
       ,SUBSTR (xdis.bom_text, 22, 24)                                    Design_Contact
       ,SUBSTR (xdis.bom_text, 48, 14)                                    Technilogy_Concatact
       ,NULL                                                              position
  FROM wip_discrete_jobs wdjo,
       wip_entities weo,
       mtl_system_items_b mtl,
       wip_schedule_groups wsg,
       mfg_lookups mfl,    
       (SELECT pa.parent_task_id, wdj.task_id, wdj.project_id
          FROM wip_discrete_jobs wdj, wip_entities we, pa_tasks pa
         WHERE wdj.wip_entity_id = we.wip_entity_id
           AND wdj.organization_id = we.organization_id
          AND we.wip_entity_name = NVL(:p_Workorder_From, we.wip_entity_name)
           AND wdj.task_id = pa.task_id
           AND wdj.project_id = pa.project_id) x,        
       (SELECT xxdis_sco_generic_pkg.xxdis_sco_bom_text(:p_Workorder_From) bom_text FROM DUAL) xdis        
 WHERE wdjo.wip_entity_id = weo.wip_entity_id
   AND wdjo.organization_id = weo.organization_id
   AND x.parent_task_id(+) = wdjo.task_id
   AND wdjo.project_id = x.project_id(+)
</sqlStatement>
<sqlStatement name="Q_RoutingEntryHeader">
SELECT DISTINCT wo.operation_seq_num operation_num,
                bso.operation_code activity,
                bso.operation_description activity_description,
                bd.description workcenter, br.resource_code machine_num,
                TO_CHAR (wo.first_unit_start_date,
                         'DD-MM-YY HH24:MI'
                        ) planned_start_date,
                TO_CHAR (wo.last_unit_completion_date,
                         'DD-MM-YY HH24:MI'
                        ) planned_end_date,
                DECODE (ca.activity,
                        'Run', bor.usage_rate_or_amount,
                        0
                       ) preparation_time,
                we.wip_entity_name work_order_no,
                   DECODE
                        (ca.activity,
                         'Prerun', bor.usage_rate_or_amount,
                         0
                        )
                || '/'
                || bor.assigned_units run_time_or_num_of_workers,
                (  (  DECODE (ca.activity,
                              'Run', bor.usage_rate_or_amount,
                              0
                             )
                    + DECODE (ca.activity,
                              'Prerun', bor.usage_rate_or_amount,
                              0
                             )
                   )
                 * bor.assigned_units
                 / 60
                ) total_time_in_hours,
                xxdps_sco_total.grand_total grand_total            
           FROM wip_discrete_jobs wdj,
                wip_entities we,
                mtl_system_items msi,
                bom_departments bd,
                wip_operations wo,
                bom_operation_sequences bos,
                bom_standard_operations bso,
                bom_operation_resources bor,
                bom_resources br,
                cst_activities ca,
                (SELECT   we.wip_entity_name entity_name,
                          SUM
                             ((  (  DECODE (ca.activity,
                                            'Run', bor.usage_rate_or_amount,
                                            0
                                           )
                                  + DECODE (ca.activity,
                                            'Prerun', bor.usage_rate_or_amount,
                                            0
                                           )
                                 )
                               * bor.assigned_units
                               / 60
                              )
                             ) grand_total
                     FROM wip_discrete_jobs wdj,
                          wip_entities we,
                          wip_operations wo,
                          bom_operation_sequences bos,
                          bom_standard_operations bso,
                          bom_operation_resources bor,
                          bom_resources br,
                          cst_activities ca
                    WHERE wdj.wip_entity_id = we.wip_entity_id
                      AND wdj.wip_entity_id = wo.wip_entity_id
                      AND wo.operation_sequence_id = bos.operation_sequence_id
                      AND bos.standard_operation_id =
                                                     bso.standard_operation_id
                      AND bor.operation_sequence_id = wo.operation_sequence_id
                      AND bor.resource_id = br.resource_id
                      AND ca.activity_id(+) = bor.activity_id
                      AND we.wip_entity_name BETWEEN :p_workorder_from
                                                 AND :p_workorder_from
                 GROUP BY we.wip_entity_name) xxdps_sco_total
          WHERE wdj.wip_entity_id = we.wip_entity_id
            AND wdj.primary_item_id = msi.inventory_item_id
            AND wdj.organization_id = msi.organization_id
        NVL(:p_Workorder_From,we.wip_entity_name)
</sqlStatement>
</dataQuery>
<dataStructure>
<group name  ="G_ReportHeader" source="Q_ReportHeader">
<element name="C_Company_Name" value="Company_Name"/>
<element name="C_CNum" value="Comp_Num"/>
<element name="C_Item_Number" value="Item_Number"/>
<element name="C_Running_Number" value="Running_Number"/>
<element name="C_Item_Description" value="Item_Description"/>
<element name="C_Work_Order_No" value="Work_Order_No"/>
<element name="C_Drawing_No" value="Drawing_No"/>
<element name="C_Internal_Order_name" value="Internal_Order_name"/>
<element name="C_Planned_start_date" value="Planned_start_date"/>
<element name="C_Planned_end_date" value="Planned_end_date"/>
<element name="C_Raw_material_warehouse" value="Raw_material_warehouse"/>
<element name="C_finish_goods_subinv" value="finish_goods_subinv"/>
<element name="C_Quantity_ordered" value="Quantity_ordered"/>
<element name="C_Weight" value="Weight"/>
<element name="C_Quantity_completed" value="Quantity_completed"/>
<element name="C_WO_STATUS" value="wo_status" />
</group>

<group name  ="G_DATE" source="Q_DATE">
<element name="C_sys_date" value="sys_date"/>
</group>

<group name  ="G_DEPT_XX" source="Q_DEPT_WC">
<element name="C_sled_pracovist_workcentre" value="sled_pracovist_workcentre"/>
</group>
<group name  ="G_RoutingHeader" source="Q_RoutingHeader">
<element name="C_Item_Number" value="Item_Number"/>
<element name="C_Qty_ordered" value="Qty_ordered"/>
<element name="C_Parent_item_description" value="Parent_item_description"/>
<element name="C_vo_parent_wo_number" value="vo_parent_wo_number"/>
<element name="C_stav_vo_parent_wo_status" value="stav_vo_parent_wo_status"/>
<element name="C_Quality_Plan_Identification" value="Quality_Plan_Identification"/>
<element name="C_Design_Contact" value="Design_Contact"/>
<element name="C_Technilogy_Concatact" value="Technilogy_Concatact"/>
<element name="C_position" value="position"/>
</group>
<group name  ="G_RoutingEntryHeader" source="Q_RoutingEntryHeader">
<element name="C_Operation_Num" value="Operation_Num"/>
<element name="C_Activity" value="Activity"/>
<element name="C_Activity_description" value="Activity_description"/>
<element name="C_Workcenter" value="Workcenter"/>
<element name="C_Machine_Num" value="Machine_Num"/>
<element name="C_Preparation_Time" value="Preparation_Time"/>
<element name="C_Run_time_or_Num_of_workers" value="Run_time_or_Num_of_workers"/>
<element name="C_Total_time_in_hours" value="Total_time_in_hours"/>
<element name="C_Work_Order_No" value="Work_Order_No"/>
<element name="C_Planned_Start_Date" value="Planned_Start_Date"/>
<element name="C_Planned_End_Date" value="Planned_End_Date"/>
<element name="C_grand_total" value="grand_total"/>
</group>
</dataStructure>
<dataTrigger name="afterReport" source="XX_PKG.xx_Print_lxx_func(:p_Workorder_From)"/>
</dataTemplate>