Developer ToolsFree generatorPDF, Excel, Word exportOracle E-Business SuiteAll Oracle E-Business Suite tools

Oracle EBS XML Publisher Data Template Generator (R12)

This generator writes an Oracle EBS R12 XML Publisher (BI Publisher) data template, the PL/SQL default package that holds its parameters and before-report trigger, and the registration steps that make it run as a concurrent program through XDODTEXE. Change the query, parameters and elements and every block updates.

Fill in

The value attribute must match a column alias in the SQL, in upper case.

Generated code
Download:

1. Data template (XXPO_OPEN_PO.xml)

<?xml version="1.0" encoding="UTF-8"?>
<dataTemplate name="XXPO_OPEN_PO" description="Open approved purchase orders" defaultPackage="XXPO_OPEN_PO_PKG" version="1.0">
  <parameters>
    <parameter name="P_ORG_ID" dataType="number"/>
    <parameter name="P_FROM_DATE" dataType="character"/>
  </parameters>
  <dataQuery>
    <sqlStatement name="Q_MAIN">
      <![CDATA[
SELECT poh.segment1        AS po_number,
       sup.vendor_name     AS supplier,
       poh.creation_date   AS po_date,
       pol.line_num        AS line_num,
       pol.item_description AS item_description,
       pol.quantity        AS quantity,
       pol.unit_price      AS unit_price
FROM   po_headers_all poh
JOIN   po_lines_all pol ON pol.po_header_id = poh.po_header_id
JOIN   ap_suppliers sup ON sup.vendor_id = poh.vendor_id
WHERE  poh.org_id = :P_ORG_ID
AND    poh.authorization_status = 'APPROVED'
AND    NVL(poh.closed_code, 'OPEN') = 'OPEN'
AND    poh.creation_date >= FND_DATE.CANONICAL_TO_DATE(:P_FROM_DATE)
ORDER  BY poh.segment1, pol.line_num
      ]]>
    </sqlStatement>
  </dataQuery>
  <dataTrigger name="beforeReport" source="XXPO_OPEN_PO_PKG.before_report"/>
  <dataStructure>
    <group name="G_PO_LINE" source="Q_MAIN">
      <element name="PO_NUMBER" value="PO_NUMBER"/>
      <element name="SUPPLIER" value="SUPPLIER"/>
      <element name="PO_DATE" value="PO_DATE"/>
      <element name="LINE_NUM" value="LINE_NUM"/>
      <element name="ITEM_DESCRIPTION" value="ITEM_DESCRIPTION"/>
      <element name="QUANTITY" value="QUANTITY"/>
      <element name="UNIT_PRICE" value="UNIT_PRICE"/>
    </group>
  </dataStructure>
</dataTemplate>

2. Default package (PL/SQL, run as APPS)

CREATE OR REPLACE PACKAGE XXPO_OPEN_PO_PKG AS
  -- Global variables named exactly like the data template parameters
  P_ORG_ID NUMBER;
  P_FROM_DATE VARCHAR2(30);

  FUNCTION before_report RETURN BOOLEAN;
END XXPO_OPEN_PO_PKG;
/

CREATE OR REPLACE PACKAGE BODY XXPO_OPEN_PO_PKG AS
  FUNCTION before_report RETURN BOOLEAN IS
  BEGIN
    -- Example: set the operating unit context before the query runs
    mo_global.set_policy_context('S', P_ORG_ID);
    RETURN TRUE;
  END before_report;
END XXPO_OPEN_PO_PKG;
/

3. Registration steps

1. Concurrent program: Application Developer > Concurrent > Program. Short name XXPO_OPEN_PO, executable XDODTEXE (Data Template Executable, application XML Publisher, execution method Java Concurrent Program), output format XML.
2. Parameters: define P_ORG_ID and P_FROM_DATE with Token = P_ORG_ID and P_FROM_DATE. The token must equal the data template parameter name. For a date entered through FND_STANDARD_DATE, keep the dataType character and convert in SQL with FND_DATE.CANONICAL_TO_DATE.
3. Add the program to the request group of the responsibility that will run it.
4. XML Publisher Administrator > Data Definitions > Create: Code = XXPO_OPEN_PO (must equal the program short name), same application as the program. Upload XXPO_OPEN_PO.xml as the Data Template.
5. XML Publisher Administrator > Templates > Create: link to data definition XXPO_OPEN_PO, type RTF, upload the layout built in the Word Template Builder.
6. Run the program; the output post-processor merges the XML with the RTF.

4. Verify the registration

SELECT d.application_short_name, d.data_source_code, d.start_date
FROM   xdo_ds_definitions_b d
WHERE  d.data_source_code = 'XXPO_OPEN_PO';

SELECT t.template_code, t.template_type_code, t.default_language, t.start_date
FROM   xdo_templates_b t
WHERE  t.data_source_code = 'XXPO_OPEN_PO';

SELECT l.lob_code, l.lob_type, l.file_name, l.language, l.last_update_date
FROM   xdo_lobs l
WHERE  l.lob_code = 'XXPO_OPEN_PO';

Element and attribute names follow the Oracle XML Publisher data template schema for R12 (dataTemplate, parameters, dataQuery, sqlStatement, dataTrigger, dataStructure, group, element). Remove the dataTrigger line and the defaultPackage attribute if you do not need a trigger. Check the XDODTEXE executable definition and the XDO table columns on your instance before relying on block 4.

Get your data template reviewed

Send the template and the request log and we will point out the binding, date or context problem.

Optional. The tool and every export work without this. No spam.

Was this tool useful?

How to use it

Start with the code, which must equal the concurrent program short name. Paste your SQL with bind variables named after the parameters (:P_ORG_ID), and list one element line per column alias in upper case. Save block 1 as an .xml file, compile block 2 as APPS, then follow block 3. To get sample XML for building the RTF layout, run the program once with output XML and no template, or open the XML from View Output, then load it into the Word Template Builder. The default query lists open approved purchase order lines from PO_HEADERS_ALL, PO_LINES_ALL and AP_SUPPLIERS so the template runs on Vision as a test.

  • One sqlStatement can feed nested groups; add child groups inside the parent group for master-detail output.
  • Keep element names stable once the RTF is built; the layout binds to them.

How the data template engine works

XDODTEXE is a seeded Java concurrent program executable that reads the data template registered against the program's data definition, binds the concurrent request parameters to the template parameters by name, fires triggers, executes the SQL and writes XML shaped by dataStructure. The beforeReport dataTrigger calls a PL/SQL function in the defaultPackage that must return BOOLEAN; returning FALSE stops the report. Parameters are passed to the package through global variables with the same names, which is why block 2 declares them in the package specification. Lexical parameters and afterReport triggers follow the same pattern.

Version differences and gotchas

The commonest failure is a token mismatch: if the concurrent program parameter token is not identical to the data template parameter name, the bind is null and the report returns no rows. The second is dates: concurrent manager passes dates from FND_STANDARD_DATE as canonical strings, so declare the parameter as character and convert with FND_DATE.CANONICAL_TO_DATE, as the default SQL does. A data definition code that differs from the program short name means the template is never found and you get raw XML. Element value attributes are matched to column aliases, so keep aliases upper case. Multi-org views or MO_GLOBAL context must be set in the trigger if the query uses secured synonyms.

How to check the result

Block 4 confirms the data definition, template and uploaded files exist in XDO_DS_DEFINITIONS_B, XDO_TEMPLATES_B and XDO_LOBS. If the request completes with a warning, open the request log: it lists the parameter values the request received, which shows a missing or mistyped value straight away; set the XML Publisher debug option if you also need the executed SQL. If the output post-processor fails, the XML output is still available from View Output, so you can test the RTF locally in Template Builder against that file.

Frequently Asked Questions

What is a data template in Oracle Apps R12?

It is an XML file that defines parameters, SQL queries, triggers and the output structure for an XML Publisher report. Registered against a data definition and run through the XDODTEXE executable, it replaces an Oracle Reports RDF as the data source, so the whole report is SQL plus an RTF layout without Reports Builder.

How do I create an XML Publisher report from a data template?

Create the concurrent program with executable XDODTEXE and output XML, add parameters whose tokens match the template parameters, create a data definition whose code equals the program short name and upload the data template, then create an RTF template against that data definition. Assign the program to a request group and run it.

How can I get sample XML for an Oracle EBS report?

Run the concurrent program with output format XML before any layout template is attached, then open View Output and save the XML. Load that file into the BI Publisher Template Builder for Word as sample data. The same XML is also retrievable as the request output file on the concurrent processing server.

Why does my data template report return no data?

Usually a parameter token does not match the data template parameter name, so the bind is null; or a date parameter arrives as a canonical string and fails conversion; or the operating unit context is not set for secured views. Check the request log for the parameter values, then fix the token, convert dates or set context in the beforeReport trigger.

If you would rather let users ask for this report in plain English and get it from EBS on your own servers, we can add that layer next to your existing XML Publisher reports.

ArchRay builder
Design the on-prem AI stack for Oracle E-Business Suite: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Runs with your ERP

AI on your ERP

Integrations

Software