---------------------------------------------------
#|========================================================================================+
#| INDUSTRIEES. |
#+========================================================================================+
# |
# Filename: REPORT_OUT_EMAIL_SH.prog |
# |
# Description: This script is developed to send the Shipping/Invoice Report |
# output to Email Id.The outfile taken from out directory is |
# sent to the EMAIL Specified. |
# |
# Revision History: |
# |
# Ver Date Author Revision Description |
# === ============ ==================== ==================== |
# 1.0 27-Apr-2011 Mahammad Sulthan Created the program |
# |
# |
# |
# |
#=========================================================================================+
#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
echo "Start of the Program"
EMAIL=`echo $1 | cut -d " " -f9`
P_EMAIL=`echo $EMAIL | cut -d '"' -f2`
PATH_NAME=`echo $1 | cut -d " " -f10`
P_DIR=`echo $PATH_NAME | cut -d '"' -f2`
P_PARENT_REQUEST_ID=`echo $1 | cut -d '"' -f12`
echo "Parameters passed :"
echo "================================================= \n"
echo "Mail id :" $P_EMAIL
echo "Outfile Directory :" $P_DIR
echo "Parent Request Id : $P_PARENT_REQUEST_ID "
echo "================================================ \n"
P_OUT_FILE_NAME="ONTCDELRI_"${P_PARENT_REQUEST_ID}"_1.PDF"
echo " Email File Name : $P_OUT_FILE_NAME "
sqlplus -s $FCP_LOGIN <<!
DECLARE
A NUMBER;
X_req_id number;
X_dev_status VARCHAR2(30) := NULL;
X_phase VARCHAR2(30) := NULL;
X_status VARCHAR2(30) := NULL;
X_dev_phase VARCHAR2(30) := NULL;
X_message VARCHAR2(200) := NULL;
BEGIN
loop
IF FND_CONCURRENT.WAIT_FOR_REQUEST
( request_id => ${P_PARENT_REQUEST_ID}
,interval => 300
,max_wait => 300
,phase => X_phase
,status => X_status
,dev_phase => X_dev_phase
,dev_status => X_dev_status
,message => X_message
)
THEN
exit;
END IF;
end loop;
END;
/
!
#---------------------------------------------------------------------------------------------------
# Checking if output file exists. If yes, then mailing them else displaying no files found
#---------------------------------------------------------------------------------------------------
if test -f $P_DIR/$P_OUT_FILE_NAME;
then
body=" Hi, \n \n This is an automated email, please do not reply to this email. Contact Helpdesk/Support Team for any further help. \n \n Thank You!"
(echo $body;uuencode "$P_DIR/$P_OUT_FILE_NAME" "$P_OUT_FILE_NAME") | mailx -m -s "Delivery Note Report" $P_EMAIL
echo "Report is completed and EMAIL has been sent to $P_EMAIL Successfully. "
else
echo "No Output files found to be sent in the mail"
fi
echo "****************************************************************"
#|========================================================================================+
#| INDUSTRIEES. |
#+========================================================================================+
# |
# Filename: REPORT_OUT_EMAIL_SH.prog |
# |
# Description: This script is developed to send the Shipping/Invoice Report |
# output to Email Id.The outfile taken from out directory is |
# sent to the EMAIL Specified. |
# |
# Revision History: |
# |
# Ver Date Author Revision Description |
# === ============ ==================== ==================== |
# 1.0 27-Apr-2011 Mahammad Sulthan Created the program |
# |
# |
# |
# |
#=========================================================================================+
#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
echo "Start of the Program"
EMAIL=`echo $1 | cut -d " " -f9`
P_EMAIL=`echo $EMAIL | cut -d '"' -f2`
PATH_NAME=`echo $1 | cut -d " " -f10`
P_DIR=`echo $PATH_NAME | cut -d '"' -f2`
P_PARENT_REQUEST_ID=`echo $1 | cut -d '"' -f12`
echo "Parameters passed :"
echo "================================================= \n"
echo "Mail id :" $P_EMAIL
echo "Outfile Directory :" $P_DIR
echo "Parent Request Id : $P_PARENT_REQUEST_ID "
echo "================================================ \n"
P_OUT_FILE_NAME="ONTCDELRI_"${P_PARENT_REQUEST_ID}"_1.PDF"
echo " Email File Name : $P_OUT_FILE_NAME "
sqlplus -s $FCP_LOGIN <<!
DECLARE
A NUMBER;
X_req_id number;
X_dev_status VARCHAR2(30) := NULL;
X_phase VARCHAR2(30) := NULL;
X_status VARCHAR2(30) := NULL;
X_dev_phase VARCHAR2(30) := NULL;
X_message VARCHAR2(200) := NULL;
BEGIN
loop
IF FND_CONCURRENT.WAIT_FOR_REQUEST
( request_id => ${P_PARENT_REQUEST_ID}
,interval => 300
,max_wait => 300
,phase => X_phase
,status => X_status
,dev_phase => X_dev_phase
,dev_status => X_dev_status
,message => X_message
)
THEN
exit;
END IF;
end loop;
END;
/
!
#---------------------------------------------------------------------------------------------------
# Checking if output file exists. If yes, then mailing them else displaying no files found
#---------------------------------------------------------------------------------------------------
if test -f $P_DIR/$P_OUT_FILE_NAME;
then
body=" Hi, \n \n This is an automated email, please do not reply to this email. Contact Helpdesk/Support Team for any further help. \n \n Thank You!"
(echo $body;uuencode "$P_DIR/$P_OUT_FILE_NAME" "$P_OUT_FILE_NAME") | mailx -m -s "Delivery Note Report" $P_EMAIL
echo "Report is completed and EMAIL has been sent to $P_EMAIL Successfully. "
else
echo "No Output files found to be sent in the mail"
fi
echo "****************************************************************"
No comments:
Post a Comment