AIM TECHNICAL DESIGN Oracle Applications FNDLOAD Unix Scripts

Team: Creation Date: Created By: Last Updated: Control: Version: Technology 2 July 2009 Brendan Furey (BrendanPF@Yahoo.com) 6 April 2010
31921461.doc

1.3

Document Control
Change Record
Date Author Version Change Reference

01-Jul2009 01-Nov2009 03-Dec2009 06-Apr2010

BP Furey BP Furey BP Furey BP Furey

1.0 1.1 1.2 1.3

Initial Added XML Templates and XML RTF file sections (upload only) Extended the XML sections, adding data template, and XDO download, and example outputs 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

Document Control

ii

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

Document Control

iii

Introduction
FNDLOAD 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 Considerations
This 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).

References

4

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 Overview
The 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 Parameters
Name Description Notes Password of apps Oracle Apps Password user Entity Key Double-quote if spaces Entity key value, field 1 Value 1 Entity Key Sometimes required Entity key value, field 2 Value 2

References

5

FNDLOAD Parameters
Po s 1 2 3 4 5 Name User/Password Value apps/[Apps Password] 0 Y DOWNLOAD $FND_TOP/patch/115/import/ [LCT File].lct 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 Sometimes secondary entity code also required Notes

Upload/Downlo ad? Control File

6

LDT File

[Entity_Key_Value_1]_[Entity Suffix].ldt

7 8

Entity Code Entity Key 1

[Entity Code]

[Entity Key Name 1]=[Entity Key Value 1] [Entity Key Name 21]=[Entity Key Sometimes required 9 Entity Key 2 Value 2] 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 Profile Level 11 LEV_NAME=[Responsibility Key] Value

Processing
The 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.

References

6

Generic Upload Specification

Input Parameters
Name Apps Password File Name 1 File Name 2 Description Notes Password of apps Oracle user File name 1 For concurrent programs only the name of a File name 2 generic request groups LDT file may be passed

FNDLOAD Parameters
Po s 1 2 3 4 5 6 7 8 Name User/Password Value apps/[Apps Password] 0 Y UPLOAD $FND_TOP/patch/115/import/ [LCT File].lct [File name] CUSTOM_MODE=FORCE Upload regardless ownership or dates Upload all in file of Notes

Upload/Downlo ad? Control File LDT File Mode Dash

Processing
The 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 o Obtain name of program (there must be only one) from the input file into local variable Replace REPNAME placeholders in input generic request groups LDT file with program to make actual request groups LDT file
References 7

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 List
Description Value Set Concurrent Program Request Set Profile Value (Responsibility/Site) Responsibility User Descriptive Flexfield Lookup XML Data Definition XML Template File Notes Recommended not to include value program files For one-at-a-time use only. Request can also be processed in the upload For one-at-a-time use only. Request can also be processed in the upload, included sets in concurrent group assignments group assignments and stage links are

Could be extended for user and application level

The download applies to either one DFF, or all, or all within an application, and the upload can process multiple lookups. Migration of XML Data Definitions, and the LDT files include the associated Layout Templates Uses Oracle's XDOLoader Java utility to load the file into a BLOB column

References

8

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=$PWD lct_file=$FND_TOP/admin/import/afffload.lct ldt_file=$admin_dir/`echo "$2" | tr "[ ]" "[_]"`_VS.ldt echo 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 = ###BOT_TEXT###quot;I###BOT_TEXT###quot;" $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

References

9

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 ###BOT_TEXT###quot;apps password###BOT_TEXT###quot; ###BOT_TEXT###quot;value set name###BOT_TEXT###quot; - quotes optional exit 1 fi admin_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/$2 ldt_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 fi if [ ! -s "$ldt_file" ] ; then ldt_file=$admin_dir/`echo "$2" | tr "[ ]" "[_]"`_VS.ldt if [ ! -s "$ldt_file" ] ; then echo The Value Set load definition file $ldt_file does not exist ! exit 1 fi fi # # Check the apps password # ret=`sqlplus -s apps/$1 <<!! !!` if [ -n "$ret" ] ; then echo Incorrect password for oracle user apps \(first parameter\) exit 1 fi echo 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/"(.+)"/'

''

Related Interests

'/' | tr '\n' ',' | sed -r 's/,$//'` sqlplus -s apps/$1 <<!! COLUMN "Value Set" FORMAT A40 COLUMN "Values" FORMAT 990 SELECT 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;

References

10

!!

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=$PWD lct_file=$FND_TOP/admin/import/afcpprog.lct lct_file_vs=$FND_TOP/admin/import/afffload.lct ldt_file=$admin_dir/$2_CP.ldt ldt_temp=/tmp/$2_CP.ldt # # Check the apps password # ret=`sqlplus -s apps/$1 <<!! !!` if [ -n "$ret" ] ; then echo Incorrect password for oracle user apps \(first parameter\) exit 1 fi echo Downloading the Program to file $ldt_file... echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp PROGRAM IMCOMPATABILITY CONCURRENT_PROGRAM_NAME=$2 FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp PROGRAM IMCOMPATABILITY CONCURRENT_PROGRAM_NAME=$2 # # Check whether the definition file contains any Programs #

References

11

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 $vs done echo 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 $vs lnvs=`grep -n "BEGIN VALUE_SET ###BOT_TEXT###quot;$vs###BOT_TEXT###quot;" $ldt_temp | awk -F: '{print $1}'` ln=`expr 2 + $lnvs` vtype=`awk -F###BOT_TEXT###quot; -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 else FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file_vs $admin_dir/"$vs"_VS.ldt VALUE_SET FLEX_VALUE_SET_NAME=$vs fi 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

References

12

# if [[ $# != 3 ]] ; then echo Usage: $0 optional exit 1 fi admin_dir=$PWD ldt_rg=$admin_dir/$3 sysdate=`date "+%Y/%m/%d"` echo $0 $sysdate

###BOT_TEXT###quot;apps

password###BOT_TEXT###quot;

###BOT_TEXT###quot;program

short

name###BOT_TEXT###quot;

###BOT_TEXT###quot;Request

Group

file###BOT_TEXT###quot;

-

quotes

lct_prog=$FND_TOP/patch/115/import/afcpprog.lct lct_rg=$FND_TOP/patch/115/import/afcpreqg.lct ldt_prog=$admin_dir/$2 ldt_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 exist exit 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 fi if [ ! -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" ] ; then echo 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_temp chmod +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/"(.+)"//'` cp1=`echo $cps1 | cut -d ' ' -f 1` if [ "$3" = "none" ] ; then echo No Request Group assignments required else

References

13

1`

app=`grep "BEGIN PROGRAM " $ldt_prog | cut -d ' ' -f 4 | sed -r 's/"(.+)"//' | cut -d ' ' -f echo Application $app and programs... for cp in $cps1 do tmp_rg=/tmp/RG_$cp echo 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

done fi

cps=`grep "BEGIN PROGRAM " $ldt_prog | cut -d ' ' -f 3 | sed -r 's/"(.+)"/'

Related Interests

''

Related Interests

'/' | tr '\n' ',' | sed -r 's/,$//'` echo $cp1 sqlplus -s apps/$1 <<!! SET LINES 120 COLUMN "Program" FORMAT A80 COLUMN "Parameter" FORMAT A30 COLUMN "Request Group" FORMAT A30 BREAK 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; !!

References

14

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=$PWD appname=$3 lct_file_rs=$FND_TOP/patch/115/import/afcprset.lct ldt_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" ] ; then echo Incorrect password for oracle user apps \(first parameter\) exit 1 fi echo Downloading the RS "$2" to file $ldt_file...

References

15

FNDLOAD apps/$1 0 Y DOWNLOAD APPLICATION_SHORT_NAME=$appname echo Downloading the RS links... FNDLOAD apps/$1 0 Y DOWNLOAD APPLICATION_SHORT_NAME=$appname

$lct_file_rs

$ldt_file

REQ_SET

REQUEST_SET_NAME="$2"

$lct_file_rs

$ldt_temp

REQ_SET_LINKS

REQUEST_SET_NAME="$2"

echo ...appending the links to $ldt_file lnvs=`grep -n "BEGIN REQ_SET_LINKS" $ldt_temp | awk -F: '{print $1}'` tail +$lnvs $ldt_temp >> $ldt_file

Example Output
Downloading the RS XXRS to file /machine/users/bfurey/fndload/XXRS_RS.ldt... Log filename : L106929.log Report filename : O106929.out Downloading 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 ###BOT_TEXT###quot;apps password###BOT_TEXT###quot; ###BOT_TEXT###quot;Request Set Code###BOT_TEXT###quot; ###BOT_TEXT###quot;Request Group file###BOT_TEXT###quot; - quotes optional exit 1 fi admin_dir=$PWD lct_file=$FND_TOP/patch/115/import/afcprset.lct ldt_file=$admin_dir/$2 lct_rg=$FND_TOP/admin/import/afcpreqg.lct ldt_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 exist exit 1 fi # #...then the standard Set and Request Group configuration files #

References

16

if [ ! -s "$lct_file" ] ; then echo The standard Request Set load configuration file $lct_file does not exist ! exit 1 fi if [ ! -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" ] ; then echo 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 required else 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/$2 FNDLOAD apps/$1 0 Y UPLOAD $lct_rg /tmp/$2 rm /tmp/$2

fi sqlplus -s apps/$1 <<!! COLUMN "Set" FORMAT A30 COLUMN "Stage" FORMAT A30 COLUMN "Progs" FORMAT 99990 BREAK 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 application_short_name='$app') AND rst.request_set_name AND rgu.unit_application_id AND rgu.request_unit_id WHERE = '$rs' = rst.application_id = rst.request_set_id

References

17

AND rgu.application_id AND rgu.request_group_id EXIT; !!`

= rgp.application_id = rgp.request_group_id);

Example Output
Processing 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

References

18

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 fi admin_dir=$PWD lct_file=$FND_TOP/patch/115/import/afscprof.lct ldt_file=$admin_dir/$2_$3_PR.ldt echo Downloading the Profile to file $ldt_file... if [ $3 = "SITE" ] ; then echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2 FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2 else echo FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2 LEV=RESPONSIBILITY LEV_NAME=$3 FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_file PROFILE PROFILE_NAME=$2 LEV=RESPONSIBILITY LEV_NAME=$3 fi # # 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 else value=`grep " PROFILE_OPTION_VALUE =" $ldt_file | cut -d '"' -f 2 ` echo Profile $2 has been downloaded, for responsibility $3, with value $value fi

References

19

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 fi admin_dir=$PWD # # Set the names of the lct and ldt files and check existence # lct_file=$FND_TOP/patch/115/import/afscprof.lct ldt_file=$admin_dir/$2 ldt_temp=/tmp/$2 if [ ! -s "$lct_file" ] ; then echo The standard Profile load configuration file $lct_file does not exist ! exit 1 fi if [ ! -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" ] ; then echo 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/"(.+)"/'

Related Interests

''

Related Interests

'/' | tr '\n' ',' | sed -r 's/,$//'` resps=`grep "BEGIN FND_PROFILE_OPTION_VALUES" $ldt_file | cut -d ' ' -f 6 | sed -r 's/"(.+)"/'

Related Interests

''

Related Interests

'/' | tr '\n' ',' | sed -r 's/,$//'` if [ "$resps" = "###BOT_TEXT###quot;**" ] ; then echo Site level sqlplus -s apps/$1 <<!! BREAK ON "Profile" ON "Value" COLUMN "Profile" FORMAT A30 COLUMN "Value" FORMAT A10 SET PAGES 1000 SELECT pn.user_profile_option_name "Profile",

References

20

FROM WHERE AND AND AND AND ORDER EXIT;

pvr.profile_option_value fnd_application_vl fnd_profile_options_vl fnd_profile_option_values ap.application_id pvr.application_id pvr.profile_option_id pvr.level_id pn.profile_option_name BY 1, 2;

"Value" ap, pn, pvr = pn.application_id = pn.application_id = pn.profile_option_id = 10001 IN ($profs)

!! else

!! fi

sqlplus -s apps/$1 <<!! BREAK ON "Profile" ON "Value" COLUMN "Profile" FORMAT A30 COLUMN "Responsibility" FORMAT A40 COLUMN "Value" FORMAT A10 SET PAGES 1000 SELECT 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;

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

References

21

# # 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=$PWD appname=$3 lct_file=$FND_TOP/patch/115/import/afscursp.lct ldt_file=$admin_dir/$2_Ry.ldt ldt_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 APPLICATION_SHORT_NAME=$appname FNDLOAD apps/$1 0 Y DOWNLOAD $lct_file $ldt_temp 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 $vs done # # 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 else n_f=`grep -c ###BOT_TEXT###quot;F###BOT_TEXT###quot; $ldt_file` n_m=`grep -c ###BOT_TEXT###quot;M###BOT_TEXT###quot; $ldt_file` echo Responsibility "$2" has been downloaded, with $n_f function and $n_m menu exclusions fi FND_RESPONSIBILITY FND_RESPONSIBILITY RESP_KEY="$2" RESP_KEY="$2"

Upload

Unix Code
#!/usr/bin/ksh #******************************************************************************* # # NAME : XX_UpRy.x #

References

22

# 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 fi admin_dir=$PWD appname=$3 # # Set the names of the lct and ldt files and check existence # lct_file=$FND_TOP/patch/115/import/afscursp.lct ldt_file=$admin_dir/$2 if [ ! -s "$lct_file" ] ; then echo The standard Responsibility load configuration file $lct_file does not exist ! exit 1 fi if [ ! -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" ] ; then echo Incorrect password for oracle user apps \(first parameter\) exit 1 fi echo 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/"(.+)"/'

Related Interests

''

Related Interests

'/' | tr '\n' ',' | sed -r 's/,$//'` echo $resps sqlplus -s apps/$1 <<!! SET PAGES 500 SET LINES 150 COLUMN responsibility_name FORMAT A45 COLUMN responsibility_key FORMAT A30 SELECT 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; !!

References

23

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=$PWD appname=$3 lct_file=$FND_TOP/patch/115/import/afscursp.lct ldt_file=$admin_dir/$2_US.ldt ldt_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"

References

24

} {

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 $vs done 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 $vs done 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 $vs done # # 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 else n_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 # #******************************************************************************* #

References

25

# Check input parameters # if [ $# != 2 ] ; then echo Usage: $0 [apps password] [User ldt file] exit 1 fi admin_dir=$PWD # # Set the names of the lct and ldt files and check existence # lct_file=$FND_TOP/patch/115/import/afscursp.lct ldt_file=$admin_dir/$2 if [ ! -s "$lct_file" ] ; then echo The standard User load configuration file $lct_file does not exist ! exit 1 fi if [ ! -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" ] ; then echo Incorrect password for oracle user apps \(first parameter\) exit 1 fi echo 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/"(.+)"/'

Related Interests