Upload
satyanarayana-chittella
View
127
Download
0
Tags:
Embed Size (px)
Citation preview
AIMTECHNICAL DESIGN
Oracle Applications FNDLOAD Unix Scripts
Team: Technology
Creation Date: 2 July 2009
Created By: Brendan Furey ([email protected])
Last Updated: 6 April 2010
Control: 31921461.doc
Version: 1.3
Document Control
Change Record
Date Author Version Change Reference
01-Jul-2009
BP Furey 1.0 Initial
01-Nov-2009
BP Furey 1.1 Added XML Templates and XML RTF file sections (upload only)
03-Dec-2009
BP Furey 1.2 Extended the XML sections, adding data template, and XDO download, and example outputs
06-Apr-2010
BP Furey 1.3 Added in Request Sets (used recently on 11.5.6 and earlier on 11.5.9)
Contents
Document Control .............................................................................. i
Change Record .............................................................................. i
Introduction ...................................................................................... 4
Functional Considerations ................................................................... 4
Data Integrity .............................................................................. 4 Values Unknown at Download Time ................................................ 5 Who Columns ............................................................................... 5 Forcing Updates ........................................................................... 5
Technical Overview ............................................................................ 5
Generic Download Specification ...................................................... 5 Generic Upload Specification .......................................................... 7 Unix Script List ............................................................................. 8
Value Sets ........................................................................................ 9
Notes .......................................................................................... 9 Download .................................................................................... 9 Upload ...................................................................................... 10
Concurrent Programs ....................................................................... 11
Notes ........................................................................................ 11 Download .................................................................................. 11 Upload ...................................................................................... 12
Request Sets ................................................................................... 15
Notes ........................................................................................ 15 Download .................................................................................. 15 Upload ...................................................................................... 16
Profile Values .................................................................................. 19
Notes ........................................................................................ 19 Download .................................................................................. 19 Upload ...................................................................................... 20
Responsibilities ................................................................................ 21
Notes ........................................................................................ 21 Download .................................................................................. 21 Upload ...................................................................................... 22
Users ............................................................................................. 24
Notes ........................................................................................ 24 Download .................................................................................. 24 Upload ...................................................................................... 25
Descriptive Flexfields ....................................................................... 26
iiDocument Control
Notes ........................................................................................ 26 Download .................................................................................. 26 Upload ...................................................................................... 28
Lookups ......................................................................................... 29
Notes ........................................................................................ 29 Download .................................................................................. 29 Upload ...................................................................................... 30
XML Data Definition ......................................................................... 31
Notes ........................................................................................ 31 Upload ...................................................................................... 31
XML Template Files .......................................................................... 33
Notes ........................................................................................ 33 Download .................................................................................. 33 Upload ...................................................................................... 35
References ...................................................................................... 38
iiiDocument Control
IntroductionFNDLOAD is an Oracle Unix utility that allows for the transfer of a wide range of Oracle Foundation (FND) data from one instance to another. It works by downloading the data in the source instance into a text file (the LDT file) that can then be uploaded into target instances. It is usually used to migrate small numbers of entities such as value sets or concurrent programs from development through test instances and into production.
It can also be used when there is a requirement to transfer large batches of records such as responsibilities and user assignments, which may arise for example when new operating units are added. Its use in such cases is described in REF-2, while we are concerned here with the former case.
Using Unix scripts to call the FNDLOAD utility allows for enforcement of standards, as discussed in the functional considerations section below, and also enables streamlining of the processes for release-to-production. This document discusses functional considerations when using FNDLOAD, provides generic specifications for scripts, and provides the Unix code for a set of scripts that I have written and used over a number of years. Version 1.0 was restricted to those recently used on an Oracle Applications 11.5.10 instance, and with v1.1 I have added Release 12 upload scripts for XML Templates and RTF files. V1.3 adds request sets tested on R11.5.6 and 11.5.9 earlier.
Functional ConsiderationsThis section discusses the functional behaviour required when using FNDLOAD within a release to production process. This determines the processing within our scripts.
Data Integrity
FNDLOAD allows for the download of individual entity instances or groups of entity instances. For example, all responsibilities couild be downloaded within a specified application. However, this creates a serious risk of uploading bad data from development into production. For this reason, we download only specified individual entity instances that are assumed to have been fully tested. Where necessary, these can then be combined into one file (or a small number of files) for installation convenience.
A second risk factor arises from the fact that FNDLOAD downloads referenced entity instances as well as the named entity instance. For example, downloading a concurrent program results in all value sets referenced also being downloaded into the LDT file. Since referenced entities may not be part of the relevant development project, they may have been separately modified. In general, only what has been modified as part of the development, and hence tested, should be uploaded. For this reason, we post-process each downloaded LDT file to remove referenced entities (but not the references to them of course).
4References
Values Unknown at Download Time
Certain values downloaded may not be appropriate for uploading. For example, effective start dates should not be earlier than the installation date, for auditing reasons; also values that are sequence-generated references and are new need to be different in production from development. Who columns are another case, as discussed in the next section. For these values, we substitute placeholders via our download scripts, and replace them with the correct values in the upload scripts.
Who Columns
‘Who’ columns are standard Oracle columns used to store the users who created and last updated the record, with the datetimes. FNDLOAD normally uploads the update values from the source system, and the same values for the creation columns for new records. We believe this is inappropriate for system-generated updates (for auditing reasons), and so we substitute SYSADMIN for the user, and use a placeholder for the update/creation date for processing as discussed in the previous section.
Forcing Updates
FNDLOAD uses an algorithm to determine whether an entity instance that exists on the target system should be overwritten or not, depending on such things as the update user and datetime on each side. As long as the data integrity measures outlined above have been taken, it is appropriate to pass the parameter CUSTOM_MODE=FORCE, which causes the updates to happen disregarding the usual algorithm.
Technical OverviewThe upload and download scripts are specified generically here. For specific details, see the actual scripts, and note that some of them may vary slightly from the specifications. Note also that testing of the scripts took place on Oracle Applications release 11.5.10. Naturally, any proposed use must be tested in the user’s own environment.
Generic Download Specification
Input ParametersName Description Notes
Apps Password Password of apps Oracle user
Entity Key Value 1
Entity key value, field 1 Double-quote if spaces
Entity Key Value 2
Entity key value, field 2 Sometimes required
5References
FNDLOAD ParametersPos
Name Value Notes
1 User/Password apps/[Apps Password]2 03 Y
4Upload/Download?
DOWNLOAD
5 Control File$FND_TOP/patch/115/import/[LCT File].lct
6 LDT File[Entity_Key_Value_1]_[Entity Suffix].ldt
For keys with spaces, the spaces are translated into underscores. A 2-letter suffix is used as a naming convention. If necessary, we may combine two key values for the prefix
7 Entity Code [Entity Code] Sometimes secondary entity code also required
8 Entity Key 1 [Entity Key Name 1]=[Entity Key Value 1]
9 Entity Key 2 [Entity Key Name 21]=[Entity Key Value 2]
Sometimes required
Next two are for profiles only, and only if at responsibility level. I have only tested profiles at site and responsibility level
10 Profile Level LEV=RESPONSIBILITY
11Profile Level Value
LEV_NAME=[Responsibility Key]
ProcessingThe processing steps for all scripts (in principle!) are outlined below.
• Validate parameters
• Set LCT and LDT file names
• Check existence of LCT files
• Check Oracle connection and password
• Download using FNDLOAD to temporary LDT file
• Remove all referenced entity blocks from the temporary LDT file and copy to the output LDT file
• List the referenced entities that were removed
• Search LDT file and report on success or failure, writing out the number of records downloaded, with any additional data relevant to the entity
The upload processing allows for the presence of a placeholder for current date, ph_sysdate. This can be set manually or programmatically as desired, for start dates and update dates. The owner of the records can be set manually to SYSADMIN if desired.
6References
Generic Upload Specification
Input ParametersName Description Notes
Apps Password Password of apps Oracle user
File Name 1 File name 1
File Name 2 File name 2
For concurrent programs only the name of a generic request groups LDT file may be passed
FNDLOAD ParametersPos
Name ValueNotes
1 User/Password apps/[Apps Password]2 03 Y
4 Upload/Download?
UPLOAD
5 Control File $FND_TOP/patch/115/import/[LCT File].lct
6 LDT File [File name]
7 Mode CUSTOM_MODE=FORCEUpload regardless of ownership or dates
8 Dash - Upload all in file
ProcessingThe processing steps for all scripts (in principle!) are outlined below.
• Validate parameters
• Set LCT and LDT file names
• Check existence of LCT files
• Check Oracle connection and password
• Search LDT file for presence of referenced entity blocks, and issue warning if found
• Replace ph_sysdate placeholders in input file with today’s date, to create the actual LDT file
• Upload using FNDLOAD
• Case: concurrent program, where a generic request groups LDT file is passed:
o Obtain name of program (there must be only one) from the input file into local variable
o Replace REPNAME placeholders in input generic request groups LDT file with program to make actual request groups LDT file
7References
o Upload request group assignments using FNDLOAD
• End Case
• Obtain list of entity keys from the input file into local variable
• List the entity records uploaded, with any relevant details, passing to SQL the local variable as a lexical parameter (SQL session)
o For concurrent programs, the request group assignments are listed too
Unix Script ListDescription Notes
Value SetRecommended not to include value sets in concurrent program files
Concurrent ProgramFor one-at-a-time use only. Request group assignments can also be processed in the upload
Request SetFor one-at-a-time use only. Request group assignments can also be processed in the upload, and stage links are included
Profile Value (Responsibility/Site)
Could be extended for user and application level
ResponsibilityUserDescriptive Flexfield
LookupThe download applies to either one DFF, or all, or all within an application, and the upload can process multiple lookups.
XML Data Definition Migration of XML Data Definitions, and the LDT files include the associated Layout Templates
XML Template File Uses Oracle's XDOLoader Java utility to load the file into a BLOB column
8References
Value Sets
Notes
These scripts are for value set migration. The download applies to one value set, but the upload can process multiple value sets in a file, which can be built by merging several files manually or programmatically.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownVS.x## DESCRIPTION : Downloads a VS XXYYvset to file XXYYvset_VS.ldt## PARAMETERS : $1 - apps password# $2 - Value Set name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 23-Jul-01 B Furey Base Version# 1.1 14-Nov-08 B Furey New version##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Value Set name]exit 1
fi
admin_dir=$PWDlct_file=$FND_TOP/admin/import/afffload.lctldt_file=$admin_dir/`echo "$2" | tr "[ ]" "[_]"`_VS.ldtecho Downloading the Value Set "$2" to file $ldt_file...echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file VALUE_SET FLEX_VALUE_SET_NAME="$2"FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file VALUE_SET FLEX_VALUE_SET_NAME="$2"## Check whether VS is Independent. If so, the values will not have been downloaded, need to redo with# different parameters.#n_vtype_i=`grep -c "VALIDATION_TYPE = \"I\"" $ldt_file`if [ $n_vtype_i = 1 ] ; then
echo Value Set is type Independent, redoing download...echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file VALUE_SET_VALUE FLEX_VALUE_SET_NAME="$2"
FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file VALUE_SET_VALUE FLEX_VALUE_SET_NAME="$2"fi## Check whether the definition file contains any Value Sets#n_vs=`grep -c "BEGIN VALUE" $ldt_file`if [ $n_vs = 0 ] ; then
echo Value Set "$2" has not been downloaded, possibly does not exist !exit 1
fi
9References
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpVS.x## DESCRIPTION : Uploads the definition of a Value Set## PARAMETERS : $1 - apps password# $2 - file name## NOTES :## MODIFIED# Version Date Who Comments# 1.1 18-Jun-01 B Furey Base Version, take VS name as parameter and # only one VS allowed# 1.2 09-Jan-09 B Furey Now use filename as second parameter, and allow# multiple VSs, but backward-compatible##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 \"apps password\" \"value set name\" - quotes optionalexit 1
fiadmin_dir=$PWD## Set the names of the lct and ldt files and check existence#lct_file=$FND_TOP/patch/115/import/afffload.lct#ldt_file=$admin_dir/$2ldt_file=$admin_dir/`echo "$2" | tr "[ ]" "[_]"`if [ ! -s "$lct_file" ] ; then
echo The standard Value Set load configuration file $lct_file does not exist !exit 1
fiif [ ! -s "$ldt_file" ] ; then
ldt_file=$admin_dir/`echo "$2" | tr "[ ]" "[_]"`_VS.ldtif [ ! -s "$ldt_file" ] ; then
echo The Value Set load definition file $ldt_file does not exist !exit 1
fifi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Uploading Value Set from file $ldt_file...FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file CUSTOM_MODE=FORCE -
vss=`grep "BEGIN VALUE_SET " $ldt_file | cut -d ' ' -f 3 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`
sqlplus -s apps/$1 <<!!COLUMN "Value Set" FORMAT A40COLUMN "Values" FORMAT 990SELECT fvs.flex_value_set_name "Value Set", Count(fvl.flex_value_set_id) "Values" FROM fnd_flex_value_sets fvs, fnd_flex_values fvl WHERE fvs.flex_value_set_nameIN ($vss) AND fvl.flex_value_set_id(+) = fvs.flex_value_set_id GROUP BY fvs.flex_value_set_name;EXIT;
10References
!!
Concurrent Programs
Notes
These scripts are for concurrent program migration, and should be used for one program at a time. It is recommended to always upload value sets separately.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownCP.x## DESCRIPTION : Downloads a CP XXYYprog to file XXYYprog_CP.ldt # in $XXYY_TOP/admin.# The file is stripped of Value Set definitions, # and customised Value Sets XXZZvset are downloaded# to file XXZZvset_VS.ldt in $XXZZ_TOP/admin.## PARAMETERS : $1 - apps password# $2 - Program short name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 19-Jun-01 B Furey Base Version# 1.1 21-Jun-01 B Furey Small code tidy# 1.2 28-Jun-01 B Furey Use afffload.lct for Value Sets and check if prog downloaded# 1.3 04-Jul-01 B Furey Check the VS type to determine entity keyword# 1.4 10-Oct-08 B Furey Use working directory, and awk iso nawk##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Program name]exit 1
fi
admin_dir=$PWDlct_file=$FND_TOP/admin/import/afcpprog.lctlct_file_vs=$FND_TOP/admin/import/afffload.lctldt_file=$admin_dir/$2_CP.ldtldt_temp=/tmp/$2_CP.ldt
## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Downloading the Program to file $ldt_file...echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp PROGRAM IMCOMPATABILITY CONCURRENT_PROGRAM_NAME=$2FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp PROGRAM IMCOMPATABILITY CONCURRENT_PROGRAM_NAME=$2## Check whether the definition file contains any Programs#
11References
n_vs=`grep -c "BEGIN PROGRAM" $ldt_temp`if [ $n_vs = 0 ] ; then
echo Program $2 has not been downloaded, possibly does not exist !exit 1
fi
awk 'BEGIN {IN_VSET="F"end_offset=2}
$1 == "BEGIN" && $2 == "VALUE_SET" {IN_VSET="T"
}$1 == "END" && $2 == "VALUE_SET" {
IN_VSET="F"end_offset=0
}{
if (IN_VSET == "F" && ++end_offset > 2) print $0}' $ldt_temp > $ldt_file
echo The program references the following Value Sets which have been deleted from the ldt file:for vs in `awk '$1 == "BEGIN" && $2 == "VALUE_SET" {print $3}' $ldt_temp | sed 's/"//g'`do
echo $vsdoneecho Downloading the following Value Sets:for vs in `awk '$1 == "BEGIN" && $2 == "VALUE_SET" {print $3}' $ldt_temp | sed 's/"//g'|grep XX`do
echo $vslnvs=`grep -n "BEGIN VALUE_SET \"$vs\"" $ldt_temp | awk -F: '{print $1}'`ln=`expr 2 + $lnvs`vtype=`awk -F\" -v LN=$ln 'NR == LN {print $2}' $ldt_temp`if [ $vtype = "I" ] ; then
FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_vs $admin_dir/"$vs"_VS.ldt VALUE_SET_VALUE FLEX_VALUE_SET_NAME=$vs
elseFNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_vs $admin_dir/"$vs"_VS.ldt VALUE_SET
FLEX_VALUE_SET_NAME=$vsfi
done
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpCP.x## DESCRIPTION : Uploads the definition of a Concurrent Program# with RG assignments for any custom module## PARAMETERS : $1 - apps password# $2 - file name# $3 - name of generic Request Group definition file or "none"## NOTES :## MODIFIED# Version Date Who Comments# 1.0x 28-Feb-03 B Furey Symantec# 1.3x 12-Mar-03 B Furey Removed Request Set treatment into separate script, dropping parameter 2# 1.4x 20-Aug-03 B Furey Corrected treatment for $3 = none, and no parameters# 1.1 10-Oct-08 B Furey New version# 1.2 18-Mar-09 B Furey Replace new placeholder sysdate by actual sysdate, and CUSTOM_MODE=FORCE# 1.3 17-Jun-09 B Furey Use placeholder ph_sysdate instead of sysdate ##*******************************************************************************## Check input parameters
12References
#if [[ $# != 3 ]] ; then
echo Usage: $0 \"apps password\" \"program short name\" \"Request Group file\" - quotes optional
exit 1fiadmin_dir=$PWDldt_rg=$admin_dir/$3
sysdate=`date "+%Y/%m/%d"`echo $0 $sysdate
lct_prog=$FND_TOP/patch/115/import/afcpprog.lctlct_rg=$FND_TOP/patch/115/import/afcpreqg.lctldt_prog=$admin_dir/$2ldt_temp=/tmp/$2## Check all the necessary files are there. First, the Request Group file matching the parameter passed...#if [[ ! -s "$ldt_rg" && ! "$3" = "none" ]] ; then
echo The generic Request Group file $ldt_rg does not existexit 1
fi##...then the standard Program/Set and Request Group configuration files#if [ ! -s "$lct_prog" ] ; then
echo The standard Program load configuration file $lct_prog does not exist !exit 1
fiif [ ! -s "$lct_rg" ] ; then
echo The standard Request Group load configuration file $lct_rg does not exist !exit 1
fi##...finally the Program/Set definition file#if [ ! -s "$ldt_prog" ] ; then
echo The Program/Set load definition file $ldt_prog does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fi## Check whether the definition file contains any Value Sets#n_vs=`grep -c "BEGIN VALUE_SET" $ldt_prog`if [ ! $n_vs = 0 ] ; then
echo Warning: File $ldt_prog contains $n_vs Value Set definitions. Is this wise...?fi## First the prog...#sed "s:ph_sysdate:$sysdate:" $ldt_prog > $ldt_tempchmod +w $ldt_temp
echo Processing Load file $ldt_temp...echo FNDLOAD apps/$1 0 Y UPLOAD $lct_prog $ldt_temp CUSTOM_MODE=FORCE -FNDLOAD apps/$1 0 Y UPLOAD $lct_prog $ldt_temp CUSTOM_MODE=FORCE -## ...then the Request Group assignments, creating the temporary RG configuration file from the relevant generic one# substituting the prog name for the placeholder#cps1=`grep "BEGIN PROGRAM " $ldt_prog | cut -d ' ' -f 3 | sed -r 's/"(.+)"/\1/'`cp1=`echo $cps1 | cut -d ' ' -f 1`if [ "$3" = "none" ] ; then
echo No Request Group assignments requiredelse
13References
app=`grep "BEGIN PROGRAM " $ldt_prog | cut -d ' ' -f 4 | sed -r 's/"(.+)"/\1/' | cut -d ' ' -f 1`
echo Application $app and programs...for cp in $cps1do
tmp_rg=/tmp/RG_$cpecho Processing Request Group assignments file $ldt_rg, using temp file $tmp_rg...sed "s:sysdate:$sysdate:" $ldt_rg | sed 's/REPNAME/'$cp'/' | sed 's/APPNAME/'$app'/'
> $tmp_rg
echo FNDLOAD apps/$1 0 Y UPLOAD $lct_rg $tmp_rg CUSTOM_MODE=FORCE -FNDLOAD apps/$1 0 Y UPLOAD $lct_rg $tmp_rg CUSTOM_MODE=FORCE -rm $tmp_rg
donefi
cps=`grep "BEGIN PROGRAM " $ldt_prog | cut -d ' ' -f 3 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`echo $cp1sqlplus -s apps/$1 <<!!SET LINES 120COLUMN "Program" FORMAT A80COLUMN "Parameter" FORMAT A30COLUMN "Request Group" FORMAT A30BREAK ON "Program"SELECT prg.user_concurrent_program_name || ': ' || prg.concurrent_program_name "Program", fcu.column_seq_num || ': ' || fcu.end_user_column_name "Parameter" FROM fnd_concurrent_programs_vl prg LEFT JOIN fnd_descr_flex_column_usages fcu ON fcu.descriptive_flexfield_name = '\$SRS\$.' || prg.concurrent_program_name AND fcu.descriptive_flex_context_code = 'Global Data Elements' WHERE prg.concurrent_program_name IN ($cps) ORDER BY 1, 2;
SELECT rgp.request_group_name "Request Group" FROM fnd_request_groups rgp WHERE EXISTS (SELECT 'In group'
FROM fnd_request_group_units rgu, fnd_concurrent_programs cpr WHERE cpr.concurrent_program_name = '$cp1' AND rgu.unit_application_id = cpr.application_id AND rgu.request_unit_id = cpr.concurrent_program_id AND rgu.application_id = rgp.application_id AND rgu.request_group_id = rgp.request_group_id)
ORDER BY 1;EXIT;!!
14References
Request Sets
Notes
These scripts are for request set migration, and should be used for one set at a time. They handle stage linking automatically.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownRS.x## DESCRIPTION : Downloads a RS rscode to file rscode_RS.ldt in working directory# Note the download is in two stages, first the entity REQ_SET, then the# REQ_SET_LINKS whose output file is appended to the first. This file can be uploaded# using XX_UpRS.x which will upload both Request Set and links## PARAMETERS : $1 - apps password# $2 - Request Set code# $3 - App short name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 04-Jul-01 B Furey Base Version# 1.1 24-Jul-01 B Furey Change name and add file and password checks# 1.2 20-Aug-01 B Furey Convert spaces to _ in RS name, and pass the module as third arg##*******************************************************************************## Check input parameters#if [ $# != 3 ] ; then
echo Usage: $0 [apps password] [Request Set code] [App Short Name]exit 1
fi
admin_dir=$PWDappname=$3
lct_file_rs=$FND_TOP/patch/115/import/afcprset.lctldt_file=`echo $admin_dir/$2_RS.ldt|tr " " "_"`ldt_temp=`echo /tmp/$2_RSL.ldt|tr " " "_"`## Check all the necessary files are there.#if [ ! -s "$lct_file_rs" ] ; then
echo The standard Request Set load configuration file $lct_file_rs does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Downloading the RS "$2" to file $ldt_file...
15References
FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_rs $ldt_file REQ_SET REQUEST_SET_NAME="$2" APPLICATION_SHORT_NAME=$appname
echo Downloading the RS links...FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_rs $ldt_temp REQ_SET_LINKS REQUEST_SET_NAME="$2" APPLICATION_SHORT_NAME=$appname
echo ...appending the links to $ldt_filelnvs=`grep -n "BEGIN REQ_SET_LINKS" $ldt_temp | awk -F: '{print $1}'`tail +$lnvs $ldt_temp >> $ldt_file
Example OutputDownloading the RS XXRS to file /machine/users/bfurey/fndload/XXRS_RS.ldt...Log filename : L106929.log
Report filename : O106929.outDownloading the RS links...Log filename : L106930.log
Report filename : O106930.out...appending the links to /machine/users/bfurey/fndload/XXRS_RS.ldt
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpRS.x## DESCRIPTION : Uploads the definition of a Request Set# with RG assignments for any custom module## PARAMETERS : $1 - apps password# $2 - Request Set File Name# $3 - Name of generic Request Group definition file or "none"## NOTES :## MODIFIED# Version Date Who Comments# 1.0 12-Mar-03 B Furey Base Version# 1.1 30-Mar-10 B Furey Minor updates. Using in 11.5.6 instance##*******************************************************************************## Check input parameters#if [[ $# != 3 ]] ; then
echo Usage: $0 \"apps password\" \"Request Set Code\" \"Request Group file\" - quotes optionalexit 1
fiadmin_dir=$PWD
lct_file=$FND_TOP/patch/115/import/afcprset.lctldt_file=$admin_dir/$2lct_rg=$FND_TOP/admin/import/afcpreqg.lctldt_rg=$admin_dir/$3## Check all the necessary files are there. First, the Request Group file matching the parameter passed...#if [[ ! -s "$ldt_rg" && ! "$3" = "none" ]] ; then
echo The generic Request Group file $ldt_rg does not existexit 1
fi##...then the standard Set and Request Group configuration files#
16References
if [ ! -s "$lct_file" ] ; thenecho The standard Request Set load configuration file $lct_file does not exist !exit 1
fiif [ ! -s "$lct_rg" ] ; then
echo The standard Request Group load configuration file $lct_rg does not exist !exit 1
fi##...finally the Set definition file#if [ ! -s "$ldt_file" ] ; then
echo The Set load definition file $ldt_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fi## First the set...#echo Processing Load file $ldt_file...echo FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file -FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file -## ...then the Request Group assignments, creating the temporary RG configuration file from the relevant generic one# substituting the prog name for the placeholder, and replacing the "P" with "P" or "S" as passed#rs=`grep "BEGIN REQ_SET " $ldt_file | cut -d '"' -f 4`app=`grep "BEGIN REQ_SET " $ldt_file | cut -d '"' -f 2`if [ "$3" = "none" ] ; then
echo No Request Group assignments requiredelse
echo Processing Request Group assignments file $ldt_rg...sed 's/"P"/"S"/' $ldt_rg | sed 's/REPNAME/'$rs'/' > /tmp/$2
echo FNDLOAD apps/$1 0 Y UPLOAD $lct_rg /tmp/$2FNDLOAD apps/$1 0 Y UPLOAD $lct_rg /tmp/$2rm /tmp/$2
fisqlplus -s apps/$1 <<!!COLUMN "Set" FORMAT A30COLUMN "Stage" FORMAT A30COLUMN "Progs" FORMAT 99990BREAK ON "Set"SELECT rst.request_set_name "Set", stg.stage_name "Stage", Count(rsp.request_set_program_id) "Progs" FROM fnd_request_sets rst, fnd_req_set_stages_form_v stg, fnd_request_set_programs rsp WHERE rst.application_id=(SELECT application_id
FROM fnd_application WHERE application_short_name='$app') AND rst.request_set_name = '$rs' AND stg.set_application_id (+) = rst.application_id AND stg.request_set_id (+) = rst.request_set_id AND rsp.set_application_id (+) = stg.set_application_id AND rsp.request_set_id (+) = stg.request_set_id AND rsp.request_set_stage_id (+) = stg.request_set_stage_id GROUP BY rst.request_set_name, stg.stage_name ORDER BY rst.request_set_name, stg.stage_name; SELECT rgp.request_group_name "Added to Request Groups" FROM fnd_request_groups rgp WHERE EXISTS (SELECT 'In group'
FROM fnd_request_group_units rgu, fnd_request_sets rst WHERE rst.application_id = (SELECT application_id
FROM fnd_application WHERE
application_short_name='$app') AND rst.request_set_name = '$rs' AND rgu.unit_application_id = rst.application_id AND rgu.request_unit_id = rst.request_set_id
17References
AND rgu.application_id = rgp.application_id AND rgu.request_group_id = rgp.request_group_id);
EXIT;!!`
Example OutputProcessing Load file /machine/apps/ebs_1/appl1/xx/import/XXRS_RS.ldt...
FNDLOAD apps/apps 0 Y UPLOAD /machine/apps/ebs_1/appl1/fnd/11.5.0/patch/115/import/afcprset.lct /machine/apps/ebs_1/appl1/xx/import/XXRS_RS.ldt -
Log filename : L106901.log
Report filename : O106901.out
Processing Request Group assignments file /machine/apps/ebs_1/appl1/xx/import /XX_Reports_RG.ldt...
FNDLOAD apps/<apps password> 0 Y UPLOAD /machine/apps/ebs_1/appl1/fnd/11.5.0/admin/import/afcpreqg.lct /tmp/XXRS_RS.ldt
Log filename : L106902.log
Report filename : O106902.out
Set Stage Progs
------------------------------ ------------------------------ ------
XXRS STAGE1 1
STAGE2 1
Added to Request Groups
------------------------------
XX Reports
18References
Profile Values
Notes
These scripts are for migration of profile values at site or responsibility level. The download applies to one profile value, but the upload can process multiple profile values in a file, which can be built by merging several files manually or programmatically.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownPR.x## DESCRIPTION : Downloads a Profile prof for responsibility resp to file # XXYYprof_resp_PR.ldt, or resp can be SITE## PARAMETERS : $1 - apps password# $2 - Profile name# $3 - Responsibility key## NOTES :## MODIFIED# Version Date Who Comments# 1.0 24-Jul-01 B Furey Base Version# 1.1 26-Nov-08 B Furey Responsibility level##*******************************************************************************## Check input parameters#if [ $# != 3 ] ; then
echo Usage: $0 [apps password] [Profile name] [Responsibility key]exit 1
fiadmin_dir=$PWDlct_file=$FND_TOP/patch/115/import/afscprof.lctldt_file=$admin_dir/$2_$3_PR.ldt
echo Downloading the Profile to file $ldt_file...
if [ $3 = "SITE" ] ; thenecho FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2
elseecho FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2
LEV=RESPONSIBILITY LEV_NAME=$3FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2 LEV=RESPONSIBILITY
LEV_NAME=$3fi# # Check whether the definition file contains any Profiles#n_vs=`grep -c "BEGIN PROFILE" $ldt_file`if [ $n_vs = 0 ] ; then
echo Profile $2 has not been downloaded, possibly does not exist !exit 1
elsevalue=`grep " PROFILE_OPTION_VALUE =" $ldt_file | cut -d '"' -f 2 `echo Profile $2 has been downloaded, for responsibility $3, with value $value
fi
19References
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpPe.x## DESCRIPTION : Uploads the definition of Profile Values (site or responsibility level)## PARAMETERS : $1 - apps password# $2 - Profile values ldt file## NOTES :## MODIFIED# Version Date Who Comments# 1.1 29-Jan-09 B Furey Base Version##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Profile values ldt file]exit 1
fiadmin_dir=$PWD
## Set the names of the lct and ldt files and check existence#lct_file=$FND_TOP/patch/115/import/afscprof.lctldt_file=$admin_dir/$2ldt_temp=/tmp/$2
if [ ! -s "$lct_file" ] ; thenecho The standard Profile load configuration file $lct_file does not exist !exit 1
fiif [ ! -s "$ldt_file" ] ; then
echo The Profile load definition file $ldt_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fi
echo Uploading Profile Values from file from $ldt_file...FNDLOAD apps/$1 0 Y UPLOAD $lct_file ldt_file CUSTOM_MODE=FORCE -
profs=`grep "BEGIN PROFILE" $ldt_file | cut -d ' ' -f 3 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`resps=`grep "BEGIN FND_PROFILE_OPTION_VALUES" $ldt_file | cut -d ' ' -f 6 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`
if [ "$resps" = "\"**" ] ; then
echo Site levelsqlplus -s apps/$1 <<!!BREAK ON "Profile" ON "Value"COLUMN "Profile" FORMAT A30COLUMN "Value" FORMAT A10SET PAGES 1000SELECT pn.user_profile_option_name "Profile",
20References
pvr.profile_option_value "Value" FROM fnd_application_vl ap,
fnd_profile_options_vl pn,fnd_profile_option_values pvr
WHERE ap.application_id = pn.application_id AND pvr.application_id = pn.application_id AND pvr.profile_option_id = pn.profile_option_id AND pvr.level_id = 10001 AND pn.profile_option_name IN ($profs) ORDER BY 1, 2;EXIT;
!!else
sqlplus -s apps/$1 <<!!BREAK ON "Profile" ON "Value"COLUMN "Profile" FORMAT A30COLUMN "Responsibility" FORMAT A40COLUMN "Value" FORMAT A10SET PAGES 1000SELECT pn.user_profile_option_name "Profile",
pvr.profile_option_value "Value",fr.responsibility_name "Responsibility"
FROM fnd_application_vl ap, fnd_profile_options_vl pn,fnd_profile_option_values pvr,fnd_application_vl far, fnd_responsibility_vl fr
WHERE ap.application_id = pn.application_id AND pvr.application_id = pn.application_id AND pvr.profile_option_id = pn.profile_option_id AND pvr.level_id = 10003 AND fr.responsibility_id = pvr.level_value AND fr.application_id = Nvl(pvr.level_value_application_id,0) AND far.application_id = Nvl(pvr.level_value_application_id,0) AND fr.responsibility_key IN ($resps) AND pn.profile_option_name IN ($profs) ORDER BY 1, 2, 3;EXIT;
!!
fi
Responsibilities
Notes
These scripts are for migration of responsibilities, including exclusions. The download applies to one responsibility, but the upload can process multiple responsibilities in a file, which can be built by merging several files manually or programmatically. Note that you will probably also need to migrate responsibility profile values, which must be done separately.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownRy.x## DESCRIPTION : Downloads a Responsibility X (=key) to file X_Ry.ldt## PARAMETERS : $1 - apps password# $2 - Responsibility key# $3 - Application short name
21References
## NOTES :## MODIFIED# Version Date Who Comments# 1.1 18-Nov-08 B Furey Initial version##*******************************************************************************## Check input parameters#if [ $# != 3 ] ; then
echo Usage: $0 [apps password] [Responsibility name] [Application short name]exit 1
fi
admin_dir=$PWDappname=$3
lct_file=$FND_TOP/patch/115/import/afscursp.lctldt_file=$admin_dir/$2_Ry.ldtldt_temp=/tmp/$2_Ry.ldt
echo Downloading the Responsibility "$2" to file $ldt_file...echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp FND_RESPONSIBILITY RESP_KEY="$2" APPLICATION_SHORT_NAME=$appnameFNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp FND_RESPONSIBILITY RESP_KEY="$2" APPLICATION_SHORT_NAME=$appname
awk 'BEGIN {IN_VSET="F"end_offset=2}
$1 == "BEGIN" && $2 == "FND_APPLICATION" {IN_VSET="T"
}$1 == "END" && $2 == "FND_APPLICATION" {
IN_VSET="F"end_offset=0
}{
if (IN_VSET == "F" && ++end_offset > 2) print $0}' $ldt_temp > $ldt_file
echo The program references the following Applications which have been deleted from the ldt file:for vs in `awk '$1 == "BEGIN" && $2 == "FND_APPLICATION" {print $3}' $ldt_temp | sed 's/"//g'`do
echo $vsdone
## Check whether the definition file contains any Responsibilities#n_vs=`grep -c "BEGIN FND_RESP" $ldt_file`if [ $n_vs = 0 ] ; then
echo Responsibility "$2" has not been downloaded, possibly does not exist !exit 1
elsen_f=`grep -c \"F\" $ldt_file`n_m=`grep -c \"M\" $ldt_file`echo Responsibility "$2" has been downloaded, with $n_f function and $n_m menu exclusions
fi
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpRy.x#
22References
# DESCRIPTION : Uploads the definition of a Responsibility## PARAMETERS : $1 - apps password# $2 - Responsibility ldt file## NOTES :## MODIFIED# Version Date Who Comments# 1.1 18-Nov-08 B Furey Base Version# 1.2 21-Jan-09 B Furey SQL, added Order By and key##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Responsibility ldt file]exit 1
fiadmin_dir=$PWDappname=$3
## Set the names of the lct and ldt files and check existence#lct_file=$FND_TOP/patch/115/import/afscursp.lctldt_file=$admin_dir/$2
if [ ! -s "$lct_file" ] ; thenecho The standard Responsibility load configuration file $lct_file does not exist !exit 1
fiif [ ! -s "$ldt_file" ] ; then
echo The Responsibility load definition file $ldt_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Uploading Responsibility from file $ldt_file...FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file CUSTOM_MODE=FORCE -
resps=`grep "BEGIN FND_RESPONSIBILITY" $ldt_file | cut -d ' ' -f 4 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`echo $respssqlplus -s apps/$1 <<!!SET PAGES 500SET LINES 150COLUMN responsibility_name FORMAT A45COLUMN responsibility_key FORMAT A30SELECT rsp.responsibility_key, rsp.responsibility_name, Count(CASE fun.rule_type WHEN 'M' THEN 1 END) "F Exclusions", Count(CASE fun.rule_type WHEN 'F' THEN 1 END) "M Exclusions" FROM fnd_responsibility_vl rsp LEFT JOIN fnd_resp_functions fun ON fun.application_id = rsp.application_id AND fun.responsibility_id = rsp.responsibility_id WHERE rsp.responsibility_key IN ($resps) GROUP BY rsp.responsibility_key, rsp.responsibility_name ORDER BY 1;EXIT;!!
23References
Users
Notes
These scripts are for migration of users. The download applies to one user, but the upload can process multiple users in a file, which can be built by merging several files manually or programmatically.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownUS.x## DESCRIPTION : Downloads a user to file X_US.ldt## PARAMETERS : $1 - apps password# $2 - User name## NOTES :## MODIFIED# Version Date Who Comments# 1.1 25-Nov-08 B Furey Base version##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [User name]exit 1
fi
admin_dir=$PWDappname=$3
lct_file=$FND_TOP/patch/115/import/afscursp.lctldt_file=$admin_dir/$2_US.ldtldt_temp=/tmp/$2_US.ldt
echo Downloading the User "$2" to file $ldt_file...echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp FND_USER USER_NAME="$2"FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp FND_USER USER_NAME="$2"
awk 'BEGIN {IN_VSET="F"end_offset=2}
$1 == "BEGIN" && $2 == "FND_RESPONSIBILITY" {IN_VSET="T"
}$1 == "END" && $2 == "FND_RESPONSIBILITY" {
IN_VSET="F"end_offset=0
}{
if (IN_VSET == "F" && ++end_offset > 2) print $0}' $ldt_temp | awk 'BEGIN {
IN_VSET="F"end_offset=2}
$1 == "BEGIN" && $2 == "FND_APPLICATION" {IN_VSET="T"
}$1 == "END" && $2 == "FND_APPLICATION" {
IN_VSET="F"
24References
end_offset=0}{
if (IN_VSET == "F" && ++end_offset > 2) print $0}' | awk 'BEGIN {
IN_VSET="F"end_offset=2}
$1 == "BEGIN" && $2 == "FND_SECURITY_GROUPS" {IN_VSET="T"
}$1 == "END" && $2 == "FND_SECURITY_GROUPS" {
IN_VSET="F"end_offset=0
}{
if (IN_VSET == "F" && ++end_offset > 2) print $0}' > $ldt_file
echo The user references the following Applications which have been deleted from the ldt file:for vs in `awk '$1 == "BEGIN" && $2 == "FND_APPLICATION" {print $3}' $ldt_temp | sed 's/"//g'`do
echo $vsdone
echo The user references the following Responsibilities which have been deleted from the ldt file:for vs in `awk '$1 == "BEGIN" && $2 == "FND_RESPONSIBILITY" {print $4}' $ldt_temp | sed 's/"//g'`do
echo $vsdone
echo The user references the following Security Groups which have been deleted from the ldt file:for vs in `awk '$1 == "BEGIN" && $2 == "FND_SECURITY_GROUPS" {print $3}' $ldt_temp | sed 's/"//g'`do
echo $vsdone
## Check whether the definition file contains any Users#n_vs=`grep -c "BEGIN FND_USER" $ldt_file`if [ $n_vs = 0 ] ; then
echo User "$2" has not been downloaded, possibly does not exist !exit 1
elsen_f=`grep -c FND_USER_RESP_GROUPS $ldt_file`echo User "$2" has been downloaded, with $n_f responsibilities
fi
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpUS.x## DESCRIPTION : Uploads the definition of a User## PARAMETERS : $1 - apps password# $2 - User ldt file## NOTES :## MODIFIED# Version Date Who Comments# 1.0 25-Nov-08 B Furey Base Version##*******************************************************************************#
25References
# Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [User ldt file]exit 1
fiadmin_dir=$PWD
## Set the names of the lct and ldt files and check existence#lct_file=$FND_TOP/patch/115/import/afscursp.lctldt_file=$admin_dir/$2
if [ ! -s "$lct_file" ] ; thenecho The standard User load configuration file $lct_file does not exist !exit 1
fiif [ ! -s "$ldt_file" ] ; then
echo The User load definition file $ldt_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Uploading User from file $ldt_file...FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file CUSTOM_MODE=FORCE -users=`grep "BEGIN FND_USER " $ldt_file | cut -d ' ' -f 3 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`sqlplus -s apps/$1 <<!!COLUMN user_name FORMAT A20SELECT usr.user_name, Count(urg.responsibility_id) "Responsibilities" FROM fnd_user usr LEFT JOIN fnd_user_resp_groups urg ON urg.user_id = usr.user_id WHERE usr.user_nameIN ($users) GROUP BY usr.user_name;EXIT;!!
Descriptive Flexfields
Notes
These scripts are for migration of descriptive flexfields. The download applies to one DFF, but the upload can process multiple DFFs in a file, which can be built by merging several files manually or programmatically.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownDF.x## DESCRIPTION : Downloads a Descriptive Flexfield dff to file # dff_DF.ldt in $XXYY_TOP/admin.# The file is stripped of Value Set definitions, and customised Value
26References
# Sets XXZZvset are downloaded to file XXZZvset_VS.ldt in $XXZZ_TOP/admin.## PARAMETERS : $1 - apps password# $2 - Descriptive Flexfield name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 16-Dec-08 B Furey Base version##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Descriptive Flexfield name]exit 1
fiadmin_dir=$PWDlct_file=$FND_TOP/patch/115/import/afffload.lctldt_file=$admin_dir/$2_DF.ldtldt_temp=/tmp/$2_DF.ldt
## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Downloading the Descriptive Flexfield to file $ldt_file...echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp DESC_FLEX DESCRIPTIVE_FLEXFIELD_NAME=$2FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp DESC_FLEX DESCRIPTIVE_FLEXFIELD_NAME=$2## Check whether the definition file contains any Descriptive Flexfields#n_vs=`grep -c "BEGIN DESC" $ldt_temp`if [ $n_vs = 0 ] ; then
echo Descriptive Flexfield $2 has not been downloaded, possibly does not exist !exit 1
fi
awk 'BEGIN {IN_VSET="F"end_offset=2}
$1 == "BEGIN" && $2 == "VALUE_SET" {IN_VSET="T"
}$1 == "END" && $2 == "VALUE_SET" {
IN_VSET="F"end_offset=0
}{
if (IN_VSET == "F" && ++end_offset > 2) print $0}' $ldt_temp > $ldt_file
echo The program references the following Value Sets which have been deleted from the ldt file:for vs in `awk '$1 == "BEGIN" && $2 == "VALUE_SET" {print $3}' $ldt_temp | sed 's/"//g'`do
echo $vsdoneecho Downloading the following Value Sets: (doesn't work for Independent VS, see XX_DownVS.x which does work)for vs in `awk '$1 == "BEGIN" && $2 == "VALUE_SET" {print $3}' $ldt_temp | sed 's/"//g'|grep XX`do
echo $vslnvs=`grep -n "BEGIN VALUE_SET \"$vs\"" $ldt_temp | awk -F: '{print $1}'`ln=`expr 2 + $lnvs`vtype=`awk -F\" -v LN=$ln 'NR == LN {print $2}' $ldt_temp`if [ $vtype = "I" ] ; then
FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_vs $admin_dir/"$vs"_VS.ldt VALUE_SET_VALUE
27References
FLEX_VALUE_SET_NAME=$vselse
FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_vs $admin_dir/"$vs"_VS.ldt VALUE_SET FLEX_VALUE_SET_NAME=$vs
fidone
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpDF.x## DESCRIPTION : Uploads the definition of a Descriptive Flexfield## PARAMETERS : $1 - apps password# $2 - Descriptive Flexfield file name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 16-Dec-08 B Furey Base version##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Descriptive Flexfield name]exit 1
fiadmin_dir=$PWDlct_file=$FND_TOP/patch/115/import/afffload.lctldt_file=$admin_dir/$2## Check all the necessary files are there. First, the DFF lct file...#if [ ! -s "$lct_file" ] ; then
echo The standard DFF load configuration file $lct_file does not exist !exit 1
fi##...then the DFF definition file#if [ ! -s "$ldt_file" ] ; then
echo The DFF load definition file $ldt_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fi## Check whether the definition file contains any Value Sets#n_vs=`grep -c "BEGIN VALUE_SET" $ldt_file`if [ ! $n_vs = 0 ] ; then
echo Warning: File $ldt_file contains $n_vs Value Set definitions. Is this wise...?fi
echo Processing Load file $ldt_file, command is...echo FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file CUSTOM_MODE=FORCE -FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file CUSTOM_MODE=FORCE -
28References
dff=`grep "BEGIN DESC_FLEX" $ldt_file | cut -d ' ' -f 4 | sed -r 's/"(.+)"/'\''\1'\''/'`context=`grep "BEGIN DFF_CONTEXT" $ldt_file | cut -d '"' -f 2 | sed -r 's/"(.+)"/'\''\1'\''/' | tr '\n' ',' | sed -r 's/,$//'`echo $dffecho $contextsqlplus -s apps/$1 <<!!SET LINES 110COLUMN "DFF" FORMAT A30COLUMN "Context" FORMAT A30COLUMN "Column" FORMAT A40BREAK ON "DFF" ON "Context"SELECT dff.descriptive_flexfield_name "DFF", con.descriptive_flex_context_code "Context", fcu.application_column_name ||':'||fcu.end_user_column_name "Column" FROM fnd_descriptive_flexs dff, fnd_descr_flex_contexts con, fnd_descr_flex_column_usages fcu WHERE dff.descriptive_flexfield_name = $dff AND con.descriptive_flexfield_name(+)= dff.descriptive_flexfield_name AND fcu.descriptive_flexfield_name(+)= con.descriptive_flexfield_name AND fcu.descriptive_flex_context_code= con.descriptive_flex_context_code AND fcu.descriptive_flex_context_code= '$context' ORDER BY 1, 2, 3;EXIT;!!
Lookups
Notes
These scripts are for migration of lookups. The download applies to either one lookup, or all, or all within an application, and the upload can process multiple lookups.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_DownLK.x## DESCRIPTION : Downloads a Common Lookup lkp to file # lkp_LK.ldt## PARAMETERS : $1 - apps password# $2 - Lookup name \(or ALL\)# $3 - Application short name \(or ALL\)## NOTES :## MODIFIED# Version Date Who Comments# 1.1 16-Dec-08 B Furey Base version##*******************************************************************************## Check input parameters#if [ $# != 3 ] ; then
echo Usage: $0 [apps password] [Lookup name \(or ALL\)] [Application short name \(or ALL\)]exit 1
fi
admin_dir=$PWDappname=$3
lct_file=$FND_TOP/patch/115/import/aflvmlu.lctif [ $appname = "ALL" ] ; then
29References
ldt_file=$admin_dir/ALL_LK.ldtelif [ $2 = "ALL" ] ; then
ldt_file=$admin_dir/$appname\_ALL_LK.ldtelse
ldt_file=`echo $admin_dir/$2_LK.ldt|tr " " "_"`fi## Check all the necessary files are there.#if [ ! -s "$lct_file" ] ; then
echo The Lookup load configuration file $lct_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiif [ $appname = "ALL" ] ; then
echo Downloading all Lookups to file $ldt_file...FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file FND_LOOKUP_TYPE
elif [ $2 = "ALL" ] ; thenecho Downloading all Lookups for $appname to file $ldt_file...FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file FND_LOOKUP_TYPE
APPLICATION_SHORT_NAME=$appnameelse
echo Downloading the Lookup "$2" to file $ldt_file...FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file FND_LOOKUP_TYPE LOOKUP_TYPE="$2"
APPLICATION_SHORT_NAME=$appnamefi# Check whether the definition file contains any Lookupsn_lk=`grep -c "^BEGIN " $ldt_file`if [ $n_lk = 0 ] ; then
echo Lookup "$2" has not been downloaded, possibly does not exist !exit 1
elsen_lv=`grep -c "^ BEGIN " $ldt_file`echo $n_lk Lookups and $n_lv Values were downloaded
fi
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************## NAME : XX_UpLK.x## DESCRIPTION : Uploads the definition of a FND Lookup.## PARAMETERS : $1 - apps password# $2 - Lookup file name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 16-Dec-08 B Furey Base version##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [lookup name]exit 1
fi
30References
admin_dir=$PWD
lct_file=$FND_TOP/patch/115/import/aflvmlu.lctldt_file=$admin_dir/$2## Check all the necessary files are there.#if [ ! -s "$lct_file" ] ; then
echo The Lookup load configuration file $lct_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiecho Uploading the LK "$2" from file $ldt_file...FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_file CUSTOM_MODE=FORCE -#lkt=`grep "BEGIN FND_LOOKUP_TYPE" $ldt_file | cut -d ' ' -f 4 | sed -r 's/"(.+)"/'\''\1'\''/'`echo $lktsqlplus -s apps/$1 <<!!SET LINES 180COLUMN "Type" FORMAT A20COLUMN "Code" FORMAT A10COLUMN "Meaning" FORMAT A30COLUMN "Description"FORMAT A35COLUMN "Attr1" FORMAT A20COLUMN "Attr2" FORMAT A20COLUMN "Attr3" FORMAT A20BREAK ON "Type"SELECT lkt.lookup_type "Type", lkv.lookup_code "Code", lkv.meaning "Meaning", lkv.description "Description",
lkv.attribute1 "Attr1", lkv.attribute2 "Attr2", lkv.attribute3 "Attr3" FROM fnd_lookup_types lkt LEFT JOIN fnd_lookup_values lkv ON lkv.lookup_type = lkt.lookup_type WHERE lkt.lookup_type = $lkt ORDER BY 1, 2, 3;EXIT;!!
XML Data Definition
Notes
These scripts are for migration of XML Data Definitions, and the LDT files include the associated Layout Templates. The script was tested on a Release 12 instance. I have not yet written a download script.
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************# # NAME : XX_UpDD.x## DESCRIPTION : Uploads the definition of an XML Data Definition## PARAMETERS : $1 - apps password
31References
# $2 - Data Definition file name## NOTES :## MODIFIED# Version Date Who Comments# 1.0 27-Oct-09 B Furey Initial# 1.0 24-Nov-09 B Furey Change name from DT to DD: XX_UpDD.x; add date processing##*******************************************************************************## Check input parameters#if [ $# != 2 ] ; then
echo Usage: $0 [apps password] [Data Definition file name]exit 1
fisysdate=`date "+%Y/%m/%d"`echo $0 $sysdate
admin_dir=$PWD
lct_file=$XDO_TOP/patch/115/import/xdotmpl.lctldt_file=$admin_dir/$2ldt_temp=/tmp/$2## Check all the necessary files are there.#if [ ! -s "$lct_file" ] ; then
echo The Data Definition load configuration file $lct_file does not exist !exit 1
fiif [ ! -s "$ldt_file" ] ; then
echo The Data Definition load definition file $ldt_file does not exist !exit 1
fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fised "s:ph_sysdate:$sysdate:" $ldt_file > $ldt_tempchmod +w $ldt_temp
echo Uploading the Data Definition "$2" from file $ldt_temp...FNDLOAD apps/$1 0 Y UPLOAD $lct_file $ldt_temp CUSTOM_MODE=FORCE -#ddc=`grep "BEGIN XDO_DS_DEFINITIONS" $ldt_file | cut -d ' ' -f 4 | sed -r 's/"(.+)"/'\''\1'\''/'`
sqlplus -s apps/$1 <<!!SET LINES 180COLUMN "Code" FORMAT A20COLUMN "Lang" FORMAT A4COLUMN "Terr" FORMAT A4COLUMN "File" FORMAT A35
PROMPT Data Definitions... SELECT xdd.data_source_code "Code", xtm.default_language "Lang", xtm.default_territory "Terr" FROM xdo_ds_definitions_b xdd LEFT JOIN xdo_templates_b xtm ON xtm.application_short_name = xdd.application_short_name AND xtm.data_source_code = xdd.data_source_code WHERE xdd.data_source_code = $ddc ORDER BY 1, 2, 3;EXIT;!!
Example Output./XX_UpDD.x 2009/12/03Uploading the Data Definition XX_APXMTDCR_DD.ldt from file /tmp/XX_APXMTDCR_DD.ldt...
32References
Log filename : L8581376.log
Report filename : O8581376.outData Definitions...
Code Lang Terr-------------------- ---- ----XX_APXMTDCR en ZA
XML Template Files
Notes
These scripts are for migration of XML template files for BI (aka XML) Publisher reports. Currently only RTF layout templates and XML data templates are supported, but it is easy to extend to other types. It uses Oracle's XDOLoader Java utility to load the file into a BLOB column. The scripts were tested on a Release 12 instance.
Download
Unix Code#!/usr/bin/ksh#*******************************************************************************# # NAME : XX_DownXDO.x## DESCRIPTION : Downloads template files, data (xml), and layout (rtf) for given LOB code## PARAMETERS : $1 - apps password# $2 - JDBC connection string (eg: 111.11.1.111:1522:DEV)# $3 - LOB code# $4 - LOB Type# $5 - App short name## NOTES :## MODIFIED# Version Date Who Comments# 1.1 24-Nov-09 B Furey Initial##*******************************************************************************## Check input parameters#if [ $# != 5 ] ; then
echo Usage: $0 [apps password] [JDBC connection string eg: 172.16.1.233:1522:DEV] [LOB code] [LOB Type] [App short name]
exit 1fi
admin_dir=$PWD
lct_file=$XDO_TOP/patch/115/import/xdotmpl.lct## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fi
33References
if [ "$4" = "rtf" ] ; thenxdo_file_type="RTF"lob_type=TEMPLATE
elif [ "$4" = "xml" ] ; thenxdo_file_type="XML"lob_type=DATA_TEMPLATE
elseecho Invalid LOB Type - $4: Only rtf and xml files are supportedexit 1
fi
echo Downloading all template files for LOB code $3 on connection "$2"...
java oracle.apps.xdo.oa.util.XDOLoader \DOWNLOAD \-DB_USERNAME apps \-DB_PASSWORD $1 \-JDBC_CONNECTION $2 \-LOB_TYPE $lob_type \-APPS_SHORT_NAME $5 \-LANGUAGE en \-TERRITORY ZA \-LOB_CODE $3
Example Output for RTFThe following files were downloaded (I change the names for uploading):
TEMPLATE_SQLAP_XX_APXMTDCR_en_ZA.xsl
TEMPLATE_SOURCE_SQLAP_XX_APXMTDCR_en_ZA.rtfDownloading all template files for LOB code XX_APXMTDCR on connection 111.11.1.111:1522:DEV...XDOLoader started: Thu Dec 03 09:57:56 SAST 2009
Parameters passed to XDOLoader...[TERRITORY] [ZA][DB_USERNAME] [apps][LOB_CODE] [XX_APXMTDCR][DOWNLOAD] [DOWNLOAD][JDBC_CONNECTION] [111.11.1.111:1522:DEV][LANGUAGE] [en][DB_PASSWORD] [******][LOB_TYPE] [TEMPLATE][APPS_SHORT_NAME] [SQLAP]
Start downloading...Downloading files from XDO_LOBS: SELECT DATA.FILE_DATA, DATA.LOB_CODE, DATA.LOB_TYPE, DATA.APPLICATION_SHORT_NAME, DATA.FILE_NAME, DATA.LANGUAGE, DATA.TERRITORY, DATA.XDO_FILE_TYPE FROM XDO_LOBS DATA, (SELECT LOB_CODE, LOB_TYPE, APPLICATION_SHORT_NAME, FILE_NAME, LANGUAGE, TERRITORY, XDO_FILE_TYPE FROM XDO_LOBS WHERE LOB_CODE = :LOB_CODE AND APPLICATION_SHORT_NAME = :APPS_SHORT_NAME AND LOB_TYPE in (:TEMPLATE, :TEMPLATE_SOURCE) AND LANGUAGE = :LANGUAGE AND TERRITORY = :TERRITORY ) TERMSwhere DATA.LOB_CODE = TERMS.LOB_CODE and DATA.LOB_TYPE = TERMS.LOB_TYPE and DATA.APPLICATION_SHORT_NAME = TERMS.APPLICATION_SHORT_NAME and DATA.LANGUAGE = TERMS.LANGUAGE and DATA.TERRITORY = TERMS.TERRITORY
XDOLoader done successfully: Thu Dec 03 09:57:57 SAST 2009
Example Output for XMLThe following files were downloaded (I change the names for uploading):
DATA_TEMPLATE_SQLAP_XX_APXMTDCR.xmlDownloading all template files for LOB code XX_APXMTDCR on connection 111.11.1.111:1522:DEV...XDOLoader started: Thu Dec 03 09:55:44 SAST 2009
34References
Parameters passed to XDOLoader...[TERRITORY] [ZA][DB_USERNAME] [apps][LOB_CODE] [XX_APXMTDCR][DOWNLOAD] [DOWNLOAD][JDBC_CONNECTION] [111.11.1.111:1522:DEV][LANGUAGE] [en][DB_PASSWORD] [******][LOB_TYPE] [DATA_TEMPLATE][APPS_SHORT_NAME] [SQLAP]
Start downloading...Downloading files from XDO_LOBS: SELECT DATA.FILE_DATA, DATA.LOB_CODE, DATA.LOB_TYPE, DATA.APPLICATION_SHORT_NAME, DATA.FILE_NAME, DATA.LANGUAGE, DATA.TERRITORY, DATA.XDO_FILE_TYPE FROM XDO_LOBS DATA, (SELECT LOB_CODE, LOB_TYPE, APPLICATION_SHORT_NAME, FILE_NAME, LANGUAGE, TERRITORY, XDO_FILE_TYPE FROM XDO_LOBS WHERE LOB_CODE = :LOB_CODE AND APPLICATION_SHORT_NAME = :APPS_SHORT_NAME AND LOB_TYPE = :LOB_TYPE AND LANGUAGE = :LANGUAGE AND TERRITORY = :TERRITORY ) TERMSwhere DATA.LOB_CODE = TERMS.LOB_CODE and DATA.LOB_TYPE = TERMS.LOB_TYPE and DATA.APPLICATION_SHORT_NAME = TERMS.APPLICATION_SHORT_NAME and DATA.LANGUAGE = TERMS.LANGUAGE and DATA.TERRITORY = TERMS.TERRITORY
XDOLoader done successfully: Thu Dec 03 09:55:45 SAST 2009
Upload
Unix Code#!/usr/bin/ksh#*******************************************************************************# # NAME : XX_UpXDO.x## DESCRIPTION : Uploads a template file, either data (xml), or layout (rtf) only for now)## PARAMETERS : $1 - apps password# $2 - JDBC connection string (eg: 111.11.1.111:1522:DEV)# $3 - LOB code# $4 - App short name# $5 - Template file name## NOTES :## MODIFIED# Version Date Who Comments# 1.1 27-Oct-09 B Furey Initial# 1.2 09-Nov-09 B Furey -CUSTOM_MODE FORCE# 1.3 24-Nov-09 B Furey Get xdo_file_type from file extension; change from RTF to XDO in name##*******************************************************************************## Check input parameters#if [ $# != 5 ] ; then
echo Usage: $0 [apps password] [JDBC connection string eg: 172.16.1.233:1522:DEV] [LOB code] [App short name] [file name]
exit 1fi
admin_dir=$PWD
lct_file=$XDO_TOP/patch/115/import/xdotmpl.lctldt_file=$admin_dir/$5## Check all the necessary files are there.#if [ ! -s "$ldt_file" ] ; then
echo The template file $ldt_file does not exist !
35References
exit 1fi## Check the apps password#ret=`sqlplus -s apps/$1 <<!!!!`
if [ -n "$ret" ] ; thenecho Incorrect password for oracle user apps \(first parameter\)exit 1
fiext=`echo $ldt_file | cut -d "." -f2`echo $ldt_file of extension $ext
if [ "$ext" = "rtf" ] ; thenxdo_file_type="RTF"lob_type=TEMPLATE
elif [ "$ext" = "xml" ] ; thenxdo_file_type="XML"lob_type=DATA_TEMPLATE
elseecho Only rtf and xml files are supportedexit 1
fi
echo Uploading the Template $4 for $3 on connection "$2"...java oracle.apps.xdo.oa.util.XDOLoader \UPLOAD \-DB_USERNAME apps \-DB_PASSWORD $1 \-JDBC_CONNECTION $2 \-LOB_TYPE $lob_type \-APPS_SHORT_NAME $4 \-LOB_CODE $3 \-LANGUAGE en \-TERRITORY ZA \-NLS_LANG American_America.WE8ISO8859P1 \-XDO_FILE_TYPE $xdo_file_type \-FILE_NAME $ldt_file \-CUSTOM_MODE FORCE#
sqlplus -s apps/$1 <<!!SET LINES 180COLUMN "Code" FORMAT A20COLUMN "Lang" FORMAT A4COLUMN "Terr" FORMAT A4COLUMN "File" FORMAT A35BREAK ON "Code" ON "Lang" ON "Terr"
PROMPT Templates and Files...SELECT xdd.data_source_code "Code", xtm.default_language "Lang", xtm.default_territory "Terr", xlb.file_name "File" FROM xdo_ds_definitions_b xdd LEFT JOIN xdo_templates_b xtm ON xtm.application_short_name = xdd.application_short_name AND xtm.data_source_code = xdd.data_source_code LEFT JOIN xdo_lobs xlb ON xlb.lob_code = xtm.data_source_code WHERE xdd.data_source_code = '$3' ORDER BY 1, 2, 3, 4;EXIT;!!
36References
Example Output for RTF/home/brendanf/bin/XX_APXMTDCR.rtf of extension rtfUploading the Template /home/brendanf/bin/XX_APXMTDCR.rtf for XX_APXMTDCR on connection 111.11.1.111:1522:DEV...XDOLoader started: Thu Dec 03 09:52:40 SAST 2009
Parameters passed to XDOLoader...[TERRITORY] [ZA][FILE_NAME] [/home/brendanf/bin/XX_APXMTDCR.rtf][DB_USERNAME] [apps][XDO_FILE_TYPE] [RTF][LOB_CODE] [XX_APXMTDCR][NLS_LANG] [American_America.WE8ISO8859P1][JDBC_CONNECTION] [111.11.1.111:1522:DEV][LANGUAGE] [en][DB_PASSWORD] [******][LOB_TYPE] [TEMPLATE][CUSTOM_MODE] [FORCE][UPLOAD] [UPLOAD][APPS_SHORT_NAME] [SQLAP]
Start uploading...Target file: XX_APXMTDCR.rtfUpdating the record in XDO_LOBS: XX_APXMTDCR.rtfDone updating the file in XDO_LOBS: XX_APXMTDCR.rtf
XDOLoader done successfully: Thu Dec 03 09:52:41 SAST 2009Templates and Files...
Code Lang Terr File-------------------- ---- ---- -----------------------------------XX_APXMTDCR en ZA XX_APXMTDCR.rtf XX_APXMTDCR.xsl
Example Output for XML/home/brendanf/bin/XX_APXMTDCR_DT.xml of extension xmlUploading the Template /home/brendanf/bin/XX_APXMTDCR_DT.xml for XX_APXMTDCR on connection 111.11.1.111:1522:DEV...XDOLoader started: Thu Dec 03 09:48:37 SAST 2009
Parameters passed to XDOLoader...[TERRITORY] [ZA][FILE_NAME] [/home/brendanf/bin/XX_APXMTDCR_DT.xml][DB_USERNAME] [apps][XDO_FILE_TYPE] [XML][LOB_CODE] [XX_APXMTDCR][NLS_LANG] [American_America.WE8ISO8859P1][JDBC_CONNECTION] [111.11.1.111:1522:DEV][LANGUAGE] [en][DB_PASSWORD] [******][LOB_TYPE] [DATA_TEMPLATE][CUSTOM_MODE] [FORCE][UPLOAD] [UPLOAD][APPS_SHORT_NAME] [SQLAP]
Start uploading...Target file: XX_APXMTDCR_DT.xmlCreating a new record in XDO_LOBS: XX_APXMTDCR_DT.xmlDone creating a new record in XDO_LOBS: XX_APXMTDCR_DT.xml
XDOLoader done successfully: Thu Dec 03 09:48:38 SAST 2009Templates and Files...
Code Lang Terr File-------------------- ---- ---- -----------------------------------XX_APXMTDCR en ZA XX_APXMTDCR.rtf XX_APXMTDCR.xsl XX_APXMTDCR_DT.xml
37References
ReferencesREF Document LocationREF-1
Oracle, eTRM, R11.5.10https://etrm.oracle.com/pls/trm11510/etrm_search.search
REF-2
Batch Migration and Loading of Oracle FND Data
http://www.scribd.com/BrendanP
38References