Wednesday, December 17, 2008

Move Order Transfer vs Sub-Inventory transfer

The difference between move order transfer and subinventory transfer is
In move orders, you can have an approval so you are not simply "taking" material from a subinventory that is under someone else's control.

Also, move orders create allocations. So you can place hold on the material with the intention of picking it up a little later. In subinventory transfer, there is no reservation / allocation. So until you actually pick up the material and perform the transaction, someone else can claim the material.

Friday, December 5, 2008

Script to transfer a file from one UNIX box to another

HOST = '192.168.100.2'
USER = 'username'
PASSWD = 'password'
FILE = 'myfile.log'

ftp -n $HOST << END_SCRIPT
quote USER $USER
quote PASS $PASSWD
get $FILE
quit
END_SCRIPT
exit 0

Script to check a directory and file


if [ -d /home/r12oravis/test ]
then
echo "Directory /home/r12oravis/test is available"
cd //home/r12oravis/test
if [ -f aaa.prg ]
then
echo "File exists"
if [ -r aaa.prg ]
then
echo "File readable"
if [ -s aaa.prg ]
then
echo "File is not empty"
else
echo "File is empty"
fi
else
echo "File is not readable"
fi
else
echo "File doesn't exists"
fi
else
echo "Directory doesn't exists"
fi

Monday, December 1, 2008

Running a simple Shell Script as a HOST program

There are basically 12 types of executable available in Oracle applications. They are
(Concurrent -> Program -> Executable)

1. Oracle Reports
2. Host
3. Immediate
4. PL/SQL Stored Procedure
5. SQL * Loader
6. SQL * Plus
7. Spawned
8. Java Concurrent Program
9. Java Stored Procedure
10. Perl Concurrent Program
11. Request Set Stage Function
12. Multi Language Function

We are going to see about HOST type of executable. Its generally used to run a Shell Script.

What is meant by Shell Script?
Shell Script is a collection of shell commands(UNIX commands) which will be executed sequentially. Using a shell script you can create a directory, move files, check the file availability, run a SQL command, etc....

Example for a shell script:
echo "This is a sample script run by bala kaarthik"
echo $1
echo $2
echo $3
echo $4
exit 0

In the above script the first line used to print a string. '
Note: I have used the word 'shell' many times. What is a shell actually? Its nothing but a compiler which is used to run a command. UNIX have different type of compilers(shells) like bash shell, C shell, etc... For more details on shell refer http://www.wikipedia.org/


How to register a HOST program?

1. Create a Shell program (VBBKSH.prog)
Use the above script and save it as VBBKSH.prog (case sensitive)

2.Move the shell program to the application top bin directory.
Find your application top XX_TOP. In that you can find bin directory ( if not create one and give 777 permission (read write executable for all) ). Move the file to that directory and give 777 permission to the file

3. Create a soft link
Its essential to create a soft link for your shell program. To create a soft link use the following shell command
ln -s $FND_TOP/bin/fndcpesr $XX_TOP/bin/VBBKSH

Where XX_TOP is your application top. Don't include the file extension (.prog) while creating the soft link. After executing the shell command a soft link will be created in the name of the shell program without any file extension.


4. Create Executable
Change your responsibility to "System Administrator" or "Application Developer"
Create a executable with "Execution method" as HOST and "Execution file name" as VBBKSH.
Don't forget to give the correct custom application name.

5.Create a Concurrent Program
Create the concurrent program and give the executable name which was created in the previous step

Parameters:
Regarding the parameters basically 4 parameters will be sent to the shell program by default. They are
$1 - database username/password
$2 - loginid
$3 - application username
$4 - concurrent request ID

If you want to send some parameters to the shell program that will be used as $5,$6,etc.... inside the shell program.


6.Register the concurrent program to the custom application's responsibility

7. Change to your application responsibility and run the concurrent program