Monday 26 June 2023

How To Register Shell Script as Concurrent Program in Oracle Apps

INTRODUCTION:
To run a UNIX shell script as a concurrent program, we need to register the shell script as a Host Concurrent Program. Also we need to ensure that there is execute permission for executable.

High Level Stepts:
Step to regist shell script as a host program or concurrent program in Oracle Applications.
1. Create a shell script ( say xyz) and move it to the appropriate BIN directory in Oracle Application.
2. The parameters in the shell scripts should start with $5 , $6 Onwards.
3. Rename the shell script to *.prog ( xyz.prog).
4. Change Permissions to 755 for the *.prog file.
5. Create Link to the shell Script ( ln -s $FND_TOP/bin/fndcpesr/xyz.prog) to create xyz file.
6. Now Register this executable in the application as a host executable (Using System Administrator Responsibility).

While registering the shell script as a concurrent program make sure that the first parameter in the concurrent program is passed as the Fifth parameter in the shell scripts because the first four parameters are allocated to userid,request_id,resp_id,resp_appl_id.

Step 1: mailx syntax
mailx [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr

Options:
-s – subject of an email. Mention it in double-quotes if it contains space
-a – attach the given filename to message
-b – send blind carbon copies to list of users
-c – send carbon copies to list of users
-r – set the from address.
-v – Verbose mode. This displays details of delivery on the user’s terminal

Note:- All parameters to this command are optional.

Shell Script: MAIL_SCRIPT.sh
#!/bin/bash
# |Description      : Check mail Sending throgh CP                           |
# |Change Record:                                                                             |
# |===============                                                                     |
# |Version           Date                     Author           Remarks               |
# |=======   ==========  =============    ===========  |
# |Draft            23-06-2023      XXXXXXXXXX     Initial Version  |
# +=============================================+
#Parameters from 1 to 4 i.e $1 $2 $3 $4 are standard parameters
# $1 : username/password of the database
# $2 : userid
# $3 : USERNAME
# $4 : Concurrent Request ID
ToAddress=$5
CcAddress=$6
BccAddress=$7
Subject=$8
echo ------------------
echo -Parameters received from concurrent program ..-
echo - Time : -`date`
echo ------------------
echo - Arguments  : -
echo - Apps       : -$1
echo - ToAddress  : -${ToAddress}
echo - CcAddress  : -${CcAddress}
echo - BccAddress : -${BccAddress}
echo - Subject    : -${Subject}
echo -------------------
echo - PPDDEBUGNEXTCODE 10
IP=XX.XX.XXX.41
MAIL_SUB="Invalid Object alert @ $ORACLE_SID Production Application server($IP)"
MAILING_LIST_S=erpteam@xxx.in
#mailx syntax
#echo -e "MSG Body" | mailx [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr
echo -e " Dear Team,\n\nWe have found some Invalid Object in Production, please check.\n\nThanks & Regard\nERPTEAM" | mailx -s "$MAIL_SUB" -a $attachment -c cc-addr -b bcc-addr -r from-addr $MAILING_LIST_S
if [ $? -ne 0 ]
then
echo -Entered Exception at mail sending, contact Administrator-
else
echo -Email utility completed successfully-
fi
echo -****************************************************************

Step 2: Rename the shell script to *.prog
Save the shell script to $CUSTOM_TOP/bin as MAIL_SCRIPT.prog
Change Permissions to 755 for the *.prog file.

Step 3: Create Softlink as follows
cd /$CUSTOM_TOP/bin
ln -s $FND_TOP/bin/fndcpesr MAIL_SCRIPT

Step 4: Create Executable

Step 5: Register as Concurrent Program (Using System Administrator Responsibility)

Step 6: Define User Parameters

Step 7: Run Request

Log file



No comments:

Post a Comment