Requirement is to get the emails list from value set and send an email using shell script.
Sample Shell Script:
#!/bin/ksh
#*******************************************************************************
# Name : HH_TEST_SHELL
# Date : 19-MAY-2023
# By : AskHareesh
# Description : Execute JAR File
#*******************************************************************************
MAILBODY="Hi Team,
Please find the attached report."
MAIL_SUBJECT="Sales Order Status Report"
LOGDIR="/test/dir/"
LOGFILE="SalesOrderReport.csv"
INSTANCENAME="DEV"
VALIDATEEMAILS=`sqlplus -s $FCP_LOGIN <<-BBB
set pages 0
set feedback 0
select LISTAGG(ffv.FLEX_VALUE, ',')
from apps.FND_FLEX_VALUE_SETS ffvs, apps.fnd_flex_values ffv
where 1=1
and ffvs.flex_value_set_id = ffv.flex_value_set_id
and ffvs.flex_value_set_name='ASK_HAREESH_TEST'
and NVL(ffv.enabled_flag,'N')='Y'
and TRUNC(sysdate) between TRUNC(NVL(ffv.start_date_active,SYSDATE)) AND TRUNC(NVL(ffv.end_date_active,SYSDATE))
/
EXIT
BBB
`
(echo "$MAILBODY") | mailx -s "$INSTANCENAME : $MAIL_SUBJECT" $VALIDATEEMAILS
No comments:
Post a Comment