add

About Me

My photo
Oracle Apps - Techno Functional consultant

Tuesday, June 21

Oracle XML Publisher Moving Templates and Data Definintions between EBS Instances

Overview
XML Publisher stores all the meta data and physical files for templates and data definition in BLOB columns in its schema. It is therefore time consuming to manually download information from a development instance to a test and then to a production environment especially if there are many templates to manage.

XML Publisher uses the FNDLOAD loader technology and its own XDOLoader to allow you to
move the metadata and physical files for your templates and datasources from one instance to
another.

Managing Metadata
Both templates and data definitions are stored in the database and we can use the FNDLOAD loader to download the metadata for these objects and then upload them to another instance. The FNDLOAD program needs a control file (lct) that the XML Publisher team have provided. Its structure is as follows:
XDO_DS_DEFINITIONS – attributes for data source
| KEY APPLICATION_SHORT_NAME
| KEY DATA_SOURCE_CODE
|
X_TEMPLATES – attributes for templates
| KEY TMPL_APP_SHORT_NAME
| KEY TEMPLATE_CODE
|
X_TEMPLATE_FIELDS – template fields
| KEY FIELD_NAME
Usage
Download

Using this structure we could use the FNDLOAD program to download any XML Publisher object from all data definitions and their associated templates to just an individual template file.
The FNDLOAD command takes the following format:

FNDLOAD usr/pwd@db 0 Y DOWNLOAD|UPLOAD xdotmpl.lct targetldtfile.ldt XMLP
ATTRIBUTES

If we wanted to download all data definitions and templates for Accounts Receivable we would use:

FNDLOAD apps/apps@mydb 0 Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct
XMLPData.ldt XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=AR

Notice we had to provide the full path to the xdotmpl.lct file, this is under XDO_TOP under
APPL_TOP. The definitions will be downloaded to XMLPData.ldt. Other examples of the
FNLOAD command might be:

FNDLOAD apps_read_only/apps@seed115 0 Y DOWNLOAD
$XDO_TOP/patch/115/import/xdotmpl.lct XMLPData.ldt XDO_DS_DEFINITIONS
APPLICATION_SHORT_NAME=AR DATA_SOURCE_CODE=ARXCOBLX

To download the data definition (ARXCOBLX) and all of its associated template definitions.

FNDLOAD apps_read_only/apps@seed115 0 Y DOWNLOAD
$XDO_TOP/patch/115/import/xdotmpl.lct XMLPData.ldt XDO_DS_DEFINITIONS
APPLICATION_SHORT_NAME=AR DATA_SOURCE_CODE=ARXCOBLX TMPL_APP_SHORT_NAME=AR
TEMPLATE_CODE=ARLETTER1

To download the data definition (ARXCOBLX) and one of its associated templates (ARLETTER1)
from that datasource.

Upload

Now we have a file definition of the data definition and template meta data we can now upload this data to any EBS instance. The FNDLOAD command is similar to before except we use the
UPLOAD switch.

If we wanted to upload all of our data definitions and templates we could use:

FNDLOAD apps/apps@mydb 0 Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct
XMLPData.ldt

If we only wanted to load certain data definitions or templates we could use attributes similar to the DOWNLOAD options

FNDLOAD apps/apps@mydb 0 Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct
XMLPData.ldt XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=AR

This command will upload all data definitions and templates from the AR application that appear in our ldt file.

Loading template and sample data files

XML Publisher provides a java based command line program to load template (RTF, PDF and
XSLFO), XML and XSD files to the XML Publisher tables. The program can be used to download
files from one instance and load to another.

The loader has two modes:
· File download only mode : With this mode, you can download files from the XDO_LOBS
table. You need to specify the target LOB_CODE, APPS_SHORT_NAME, LOB_TYPE
then it will download all files that match the criteria. You can also specify LANGUAGE and
TERRITORY.
· File download and LDT/DRVX generation mode : With this mode, you can download files
from the XDO_LOBS table. It also creates LDT and DRVX files for these downloaded files,
for your purposes you do not need the drvx file. This is used by Oracle development to load
templates during a patch application. You need to specify APPS_SHORT_NAME, it will
download all files (including template files, data definition files and sample xml files) that
have the same application short name. You can also specify DS_CODE to select files that
are related to the the specific data source definition.

Usage

Download

Firstly you need to ensure you have setup your environment for your session ie setting APPL_TOP,
CLASSPATH, etc.

DOWNLOAD usage (file download only mode):

% java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD \
-DB_USERNAME \
-DB_PASSWORD \
-JDBC_CONNECTION \
-LOB_TYPE \
-APPS_SHORT_NAME \
-LOB_CODE \
-LANGUAGE \
-TERRITORY \
-LOG_FILE


This mode will create the template or data files, one LDT file, one DRVX file and one log file.

Sample usage as follows:

% java oracle.apps.xdo.oa.util.XDOLoader \
DOWNLOAD \
-DB_USERNAME apps \
-DB_PASSWORD apps \
-JDBC_CONNECTION ap000sun:1521:apps115 \
-APPS_SHORT_NAME XDO \
-LCT_FILE ${XDO_TOP}/patch/115/import/xdotmpl.lct \
-DS_CODE XDODS1

In this mode the ldt file can then be used with the FNDLOAD utility to upload the metadata for te downloaded templates.

Upload


UPLOAD usage :
% java oracle.apps.xdo.oa.util.XDOLoader UPLOAD \

-DB_USERNAME \
-DB_PASSWORD \
-JDBC_CONNECTION \
-LOB_TYPE \
-APPS_SHORT_NAME \
-LOB_CODE \
-LANGUAGE \
-TERRITORY \
-XDO_FILE_TYPE \
-NLS_LANG \
-FILE_CONTENT_TYPE \
-FILE_NAME \
-OWNER \
-CUSTOM_MODE [FORCE|NOFORCE] \
-LOG_FILE



Sample usage is following.

% java oracle.apps.xdo.oa.util.XDOLoader \
UPLOAD \
-DB_USERNAME apps \
-DB_PASSWORD apps \
-JDBC_CONNECTION ap000sun:1521:apps115 \
-LOB_TYPE TEMPLATE \
-APPS_SHORT_NAME XDO \
-LOB_CODE XDOTMPL1 \
-LANGUAGE ja \
-TERRITORY JP \
-XDO_FILE_TYPE PDF \
-FILE_CONTENT_TYPE 'aplication/pdf' \
-FILE_NAME $XDO_TOP/patch/115/publisher/templates/XDOTMPL1_ja_JP.pdf
-NLS_LANG JAPANESE_JAPAN.JA16EUC

The loader can be used before or after the FNDLOAD command. The files will be loaded with its
LOB_CODE, this will join to the main metadata loaded using the TEMPLATE_CODE or
DATA_SOURCE_CODE mapping to the LOB_CODE.

No comments: