Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

Functional Documents
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new

Search Courses

Sending Output Of Concurrent Programs Via Email  

While working on Oracle Applications E- Business Suite it is a very common requirement that we want to send the output of a concurrent program as an email attachment to specific email id.  

This requirement can be easily achieved by creating a shell script which will take the output file and send email to the subscribers.  

For this you have to follow the below mentioned steps:

a) Create a Executable with execution file type as Host.

b) Create a Concurrent program which will have parameters as Request ID(for normal request whose output is stored in fnd_concurrent requests) , Output Request ID ( for XML based concurrent requests where otput is stored in fnd_conc_request_outputs), Attachment type( ‘LOG’/’OUT’ for Log file and output file respectively, Email Id ( email id to whom request needs to be send, Email Subject (Email Subject)          

Now whenever you will call this concurrent program passing the correct parameters you will be able to send the output to email id.  

Moreover, in order to have the control you can have flexibility to control which concurrent programs output you want to send via email and the corresponding email id create a lookup  

Lookup Type : XXC_GET_SUBSCRIBERS  

Code : 10,20,30 ..etc

Meaning : 10,20,30...etc

Description : Concurrent program Name whose output needs to be send  

Tag : Email ID to which the concurrent program output will be send.  

Attaching the shell script program for ready reference.  

SendEmail

When you save the above file in desktop and open with textpad , wordpad, notepad the code is as below:

#!/bin/sh
# *************************************************************************************************
# Filename: ebs2fusion_send_email.sh
# Author: Sandip
# Date Created: 14-OCT-2010
# Description: Send output/log File as an attachment
# Parameters: 1. Request ID
# 2. Output Request ID
# 2. Attachment Type: LOG / OUT
# 3. Email Ids
# 4. Email Subject
# History:
# Name Date Version Description
# --------------- ------------ ------- -----------------------
# Ashish 14-OCT-2010 1.0 Original Creation
# *************************************************************************************************

# -- ------------------------
# -- Extract input parameters
# -- ------------------------
USER_PWD=`echo $1|cut -d '"' -f2` # -- Database User/Pwd
USERNAME=`echo $1|cut -d '"' -f4` # -- UserName

REQ_ID=`echo $1|cut -d '"' -f8` # -- Request Id
OUT_REQ_ID=`echo $1|cut -d '"' -f10` # -- Output Request Id
ATTACHMENT_TYPE=`echo $1|cut -d '"' -f12` # -- Attachment Type
EMAIL_ID=`echo $1|cut -d '"' -f14` # -- Email Id
EMAIL_SUB=`echo $1|cut -d '"' -f16` # -- Email Subject

# -- ----------------------
# -- Print input parameters
# -- ----------------------
echo " "
echo "User Name: "$USERNAME
echo "Request Id: "$REQ_ID
echo "Output Request Id: "$OUT_REQ_ID
echo "Attachment Type: "$ATTACHMENT_TYPE
echo "Email Id: "$EMAIL_ID
echo "Subject: "$EMAIL_SUB
echo "---------------------------------------------------------------------------------------------"

# -- ----------------
# -- Email Validation
# -- ----------------
case $EMAIL_ID in
*@?*.?*) echo "Email Address Validated.";;
*) echo "Invalid Email Address. Please enter the correct format of email address and re-run the program";
exit 1;;
esac

if [ "$OUT_REQ_ID" == "" ]; then
echo "Fetching based on Request Id"
# -- -------------------------------------------
# -- Fetch OUT and LOG filename using Request ID
# -- -------------------------------------------
QUERY_OUTPUT=`sqlplus -s /nolog <<end_stmt1
set heading off
set feedback off
set verify off
set termout off
set pages 0

CONNECT $USER_PWD
SELECT fcq.status_code, length(fcq.logfile_name), length(fcq.outfile_name), fcq.logfile_name, fcq.outfile_name FROM fnd_concurrent_requests fcq WHERE fcq.request_id='${REQ_ID}';
end_stmt1`
else
echo "Fetching based on Output Request Id"
# -- -------------------------------------------
# -- Fetch OUT and LOG filename using Request ID
# -- -------------------------------------------
QUERY_OUTPUT=`sqlplus -s /nolog <<end_stmt1
set heading off
set feedback off
set verify off
set termout off
set pages 0

CONNECT $USER_PWD
SELECT fcq.status_code, length(fcq.logfile_name), length(fcro.file_name), fcq.logfile_name, fcro.file_name FROM fnd_concurrent_requests fcq, fnd_conc_req_outputs fcro WHERE fcq.request_id=fcro.concurrent_request_id AND fcq.request_id='${OUT_REQ_ID}';
end_stmt1`
fi

# -------------------------------------------------------------------
# -- Above query will return the value as
# -- 1. Connected. (If connected to DB)
# -- 2. Program Status (C or E)
# -- 3. Length of Log File Path and Name
# -- 4. Length of Output File Path and Name
# -- 5. Log File Path and Name
# -- 6. Output File Path and Name
# -------------------------------------------------------------------

# --------------------------------------
# -- Using cut command taking the values
# --------------------------------------
IS_CONNECTED_TO_DB=`echo $QUERY_OUTPUT|cut -d" " -f1`

if [ "$IS_CONNECTED_TO_DB" == "Connected." ]; then
#-- Getting the Program Status (C or E)
PROG_STATUS=`echo $QUERY_OUTPUT|cut -d" " -f2`
echo "PROGRAM Status: "$PROG_STATUS
else
echo "Error: Connecting to DB: "$QUERY_OUTPUT
exit 1
fi

# -------------------------------------------------
# -- Sending email
# -- LOG_FILE => Attaching the log file
# -- OUT_FILE => Attaching the output file
# -- EMAIL => Passing EMail id
# -- EMAIL_SUB => Subject of Email
# ------------------------------------------------
if [ "$ATTACHMENT_TYPE" == "OUT" ]; then
# -- Getting the output file (with path)
LEN_OUTPUT_FILE=`echo $QUERY_OUTPUT|cut -d" " -f4`
echo "Length of OUTPUT FILE: "$LEN_OUTPUT_FILE

OUTPUT_FILE=`echo $QUERY_OUTPUT|cut -d" " -f6`
echo "OUTPUT FILE: "$OUTPUT_FILE

if [ $LEN_OUTPUT_FILE -gt 80 ]; then
OUTPUT_FILE1=`echo $QUERY_OUTPUT|cut -d" " -f7`
echo "OUTPUT FILE1: "$OUTPUT_FILE1
OUTPUT_FILE=$OUTPUT_FILE$OUTPUT_FILE1
fi

echo "OUTPUT FILE: "$OUTPUT_FILE

# ---------------------------------------------------------------
# -- Sending EMail with output file attachment
# -- Using -e in echo command to print the file name in new line
# ---------------------------------------------------------------
#(echo -e "$EMAIL_BODY"; uuencode $OUTPUT_FILE OUTPUT_FILE_$REQ_ID.txt) | mail "$EMAIL_ID" -s "$EMAIL_SUB"

echo "$EMAIL_SUB"| mutt -a $OUTPUT_FILE "$EMAIL_ID" -s "$EMAIL_SUB"

echo "EMAIL has been sent with output file to $EMAIL_ID"

elif [ "$ATTACHMENT_TYPE" == "LOG" ]; then
# -- Getting the Log File (with Path)
LOG_FILE=`echo $QUERY_OUTPUT|cut -d" " -f5`

echo "LOG FILE: "$LOG_FILE

# ---------------------------------------------------------------
# -- Sending EMail with log file attachment
# -- Using -e in echo command to print the file name in new line
# ---------------------------------------------------------------
#(echo -e "$EMAIL_BODY"; uuencode $LOG_FILE LOG_FILE_$REQ_ID.txt) | mail "$EMAIL_ID" -s "$EMAIL_SUB"
#uuencode -m $LOG_FILE LOG_FILE_$REQ_ID.txt | mail "$EMAIL_ID" -s "$EMAIL_SUB"

echo "$EMAIL_SUB"| mutt -a $LOG_FILE "$EMAIL_ID" -s "$EMAIL_SUB"

echo "EMAIL has been sent with log file to $EMAIL_ID"
fi


Ashish Harbhajanka

Comments   

+1 #1 Sandy 2015-10-28 13:10
In this shell Program Users can submit multiple Email Address in Concurrent Program Parameters ?

Excellent Article !! Very Handy
Quote
0 #2 nem2760626krya 2021-05-27 17:55
mns2760626uttjr lpmbqdW vuKU UjuTU0a
Quote
0 #3 danny trejo boxing 2022-03-30 03:31
Hello just wanted to give you a brief heads up
and let you know a few of the pictures aren't loading properly.
I'm not sure why but I think its a linking issue. I've tried it in two different
browsers and both show the same results.
Quote
0 #4 typodar 2022-06-04 10:27
Паблик с единственным правильным мнением, имеющий только лояльную аудиторию. При малейшем сомнении в лояльности, подписчик удаляется. Таким образом, предлагаем Вашему вниманию рекламную площадку, зачищенную от ненужных мнений. Мы не уважаем вату и/или ура-аутистов. Всё будет Туподар! Подписывайтесь, заказывайте рекламу. Нас больше 250к!

VK
Instagram
Telegram
Реклама в Туподаре, Краснодар


https://vk.com/typodar
https://www.instagram.com/typodar/
https://t.me/typodar
https://typodar.ru/
Quote

Add comment


Security code
Refresh

About the Author

Ashish Harbhajanka

 

Oracle Fusion HCM Techno Functional Consultant with overall 10 years of Experience in software industry with 5 years in EBS HRMS and rest 5 in Fusion HCM.

My areas of intesrest in Fusion HCM include :

a) Inbound Outbound Integration using FBL/HDL or BIP/HCM Extracts.

b) Fast Formula

c) BIP Reports

d) OTBI Reports

e) RESTFUL API / Web Service Call

f) Functional Setup

g) End to End Testing

h) Regression Testing

i) Preparing COnfiguration Workbooks

j) Creating Speed Solutions

k) Preparing User Guides

l) UPK

........

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Apr 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
  1  2  3  4  5  6  7
  8  91011121314
15161718192021
22232425262728
2930     

Enquire For Training

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner