我在 IBM AIX 5.3 上使用 Oracle EBS R12.1.3
最近我有一个要求,通过邮件将并发程序的输出作为附件发送。输出为 .XLS 格式。
以下代码适用于将 XLS 格式的并发程序输出文件发送到所需的电子邮件 ID。
echo "starting the program"
echo "################################"
echo "Current Child Request ID :"$4
REQ_ID=$4
echo $REQ_ID
echo "Do you want the output through auto-generated email:" $5
if [ $5 == 'Y' ]
then
echo "As per your request generating email containing XLS output as attachment for the Concurrent request $4"
YEAH_FILE=
sqlplus -s <DB_Schema_Name>/<Schema_Password>@<Instance_Name> << EOF
set linesize 300;
set pagesize 0;
set echo off;
set serveroutput off;
set sqlblank off;
set feedback off;
set heading off;
set wrap off;
col "REQ" format 9999999;
select
'$APPLCSF/out/*' || REQUEST_ID ||'*.xls ' from FND_CONC_REQ_SUMMARY_V where REQUEST_ID ='$REQ_ID';
spool off
EOF
#Get the email ID
SEND_MAIL_ID =
' echo <Email_ID>
'
cat <<'EOF' - $YEAH_FILE | /usr/sbin/sendmail $SEND_MAIL_ID
Subject: Email with XLS output
Content-Type: application/vnd.ms-excel
MIME-Version: 1.0
Content-Disposition: attachment
EOF
else [ $5 == 'N' ]
echo "As per your request the Email won't trigger for the Concurrent request $4"
fi
exit 0;