Shell Script Tutorial for Oracle Applications

  • Steps to Register Shell Script as a concurrent program
  • Sample Shell Script to copy the file from source to destination
  • Basic Shell Script Commands

Steps to Register Shell Script as a concurrent program

step 1:
Place the <name>.prog script under the bin directory for your
applications top directory.

For example, call the script KO_DEMO.prog and place it under

step 2:
Make a symbolic link from your script to $FND_TOP/bin/fndcpesr
For example, if the script is called KO_DEMO.prog use this:

 ln -s $FND_TOP/bin/fndcpesr KO_DEMO

This link should be named the same as your script without the
.prog extension.

Put the link for your script in the same directory where the
script is located.

step 3:
Register the concurrent program, using an execution method of
‘Host’. Use the name of your script without the .prog extension
as the name of the executable.

For the example above:

step 4:
Your script will be passed at least 4 parameters, from $1 to $4.

  $1 = orauser/pwd
  $2 = userid(apps)
  $3 = username,
  $4 = request_id

Any other parameters you define will be passed in as $5 and higher.
Make sure your script returns an exit status also.

Sample Shell Script to copy the file from source to destination

#Note: If you see # in front of any line it means that its a comment line not the actual code
#** ********************************************************************
# Created By : Shivmohan P

# Creation Date : 19-Sep-2008
# Script Name : KO_demo.prog
# Description : This Script accepts three parameters
# 1)Data File Name 2)Source Directory Path 3)Target Directory Path
# Then copy the file from source location to target location.
# If copy fails send the error status/message to concurrent program so that user can see status.
# ========
# History
# ========
# Version 1 shivmohan 19-sep-2008 Created for users
#** ********************************************************************
#Parameters from 1 to 4 i.e $1 $2 $3 $4 are standard parameters
# $1 : username/password of the database
# $2 : userid
# $4 : Concurrent Request ID
echo “————————————————–”
echo “Parameters received from concurrent program ..”
echo ” Time : “`date`
echo “————————————————–”
echo “Arguments : ”
echo ” Data File Name : “${DataFileName}
echo ” SourceDirectory : “${SourceDirectory}
echo ” TargetDirectory : “${TargetDirectory}
echo “————————————————–”
echo ” Copying the file from source directory to target directory…”
cp ${SourceDirectory}/${DataFileName} ${TargetDirectory}
if [ $? -ne 0 ]
# the $? will contain the result of previously executed statement.
#It will be 0 if success and 1 if fail in many cases
# -ne represents not “equal to”

echo “Entered Exception”
exit 1
# exit 1 represents concurrent program status. 1 for error, 2 for warning 0 for success
echo “File Successfully copied from source to destination”
exit 0
echo “****************************************************************”

Basic Shell Script Commands

# Create Directory
mkdir <dirname>
# Remove Directory
rmdir <dirname>
#remove folder with files
rm -r -f <dirname>
# Change Directory
cd <newpath>
# Create new file
vi <newfile.ext>
#insert data into file
vi <openfilename.ext>
esc i <make changes>
#Save file
esc :wq enter
# exit with out saving changes
esc :q! enter
# open existing file
vi <existingfilename.ext>
#remove file
rm <filename.ext>
# copy file with same name
cp <sourcedir>/<sourcefilename.ext> <destinationdir>
# copy file with new name
cp <sourcedir>/<sourcefilename.ext> <destinationdir>/<newfilename.ext>
# Move file with same name
mv <sourcedir>/<sourcefilename.ext> <destinationdir>
# move file with data appended to filename in the front
mv <sourcedir>/<sourcefilename.ext> <destinationdir>/`date+%H%M%d%m%y`<filename.ext>
#print line
echo “your text here to print”
#print date
echo `date`

7 thoughts on “Shell Script Tutorial for Oracle Applications

  1. i want to do AUTOMATION OF FTP Utility with the help of that we can transfer a File from another application(unix based) to our application(oracle apps-AR-unix based).Also, any PROCEDURE OR PACKAGES OR SHELL SCRIPT that we can register in Apps & we can do time schedule also for running that PROCEDURE OR PACKAGES OR SHELL SCRIPT to process that file in our system and load the records in interim table.Pls help with the steps and the script.


Want to give some comment to author ( Shivmohan Purohit )

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s