Professional Documents
Culture Documents
Sending An Concurrent Request Output As Email Notification
Sending An Concurrent Request Output As Email Notification
Objective
The purpose of the white paper is to send the output of a concurrent request as an email notification
which not available in 11.5.8 version normally. Here we want to send a mail notification which contains
collective informations from various modules of the past week. Through which business users will have a
gist of information about all the necessary data.
The white paper will be useful for the starters to get an idea about the steps to follow to map the
concurrent request output to the email notification.
Here we want to know collective details of total sales, total payables, and total receipts of the past
week. So that for the reporting purpose and for collection purpose the next week tasks will be easy.
Step 1) Defining the E-mail id for the notified users
In order to send the attachment to the notified users, first we need to define the e-mail id of the users. This is
to be done in Inventory Responsibility as shown in the below mentioned screen shot.
Responsibility: SKG India Local Inventory ==>
Setup ==>
Lookups ==>
Code
Meaning
Description
Tag
==>
==>
==>
==>
User Name
Email Address
Department
CC / TO / BCC (Upper or Lower)
Page 1 of 16
Page 3 of 16
PROCEDURE THROUGHPUT_EMAIL_CONCURRENT (
p_request_id
IN
VARCHAR2,
p_from_date
IN
DATE,
p_to_date
IN
DATE,
p_company
IN
VARCHAR2
)
IS
v_request_id
NUMBER;
BEGIN
fnd_global.apps_initialize (6871, 50095, 401);
v_request_id :=
fnd_request.submit_request
(application
=>
program
=>
description
=>
start_time
=>
hh24:mi:ss'),
sub_request
=>
argument1
=>
argument2
=>
argument3
=>
argument4
=>
argument5
=>
);
COMMIT;
'INV',
--Application Name
'SONATPEMAIL', --Short Name
NULL,
--Description
TO_CHAR(SYSDATE + 2 / 1440,'dd-mon-yy
FALSE,
p_request_id,
--Argument
'erp.support@sonagroup.com',
p_from_date,
p_to_date,
p_company
IF NVL (v_request_id, 0) = 0
THEN
fnd_file.put_line (fnd_file.LOG, 'Email Concurrent Failed.');
ELSE
fnd_file.put_line (fnd_file.LOG,
'Email concurrent running successfully, Req. ID:'
|| p_request_id
);
END IF;
END;
Page 5 of 16
In the concurrent request we are attaching an executable file. So that it will call the procedure. The following
is the procedure which will create the email notification with attachment
sona_utilities.sona_throughput_report_email
PROCEDURE SONA_THROUGHPUT_REPORT_EMAIL (
errbuf
OUT
VARCHAR2,
retcode
OUT
VARCHAR2,
p_request_id
IN
VARCHAR2,
p_from
IN
VARCHAR2 DEFAULT 'erp.support@sonagroup.com',
p_from_date
IN
DATE,
p_to_date
IN
DATE,
p_company
IN
VARCHAR2
)
IS
ls_email_body
v_from
v_recipients
v_cc
v_bcc
v_subject
v_mail_host
v_mail_conn
crlf
ll_count
filename1
v_directory_name
v_file_name
v_line
mesg
v_slash_pos
v_file_handle
invalid_path
LONG
:=
VARCHAR2 (80)
:=
LONG
:=
LONG
:=
LONG
:=
VARCHAR2 (200)
:=
VARCHAR2 (30)
:=
UTL_SMTP.connection;
VARCHAR2 (2)
:=
NUMBER;
VARCHAR2 (300);
VARCHAR2 (100);
VARCHAR2 (300);
VARCHAR2 (1000);
VARCHAR2 (32767);
NUMBER;
UTL_FILE.file_type;
EXCEPTION;
NULL;
NULL;
NULL;
NULL;
NULL;
NULL;
'10.1.4.35';
CHR (13) || CHR (10);
CURSOR c1
IS
SELECT
outfile_name
filename1
fnd_concurrent_requests
request_id = p_request_id;
Page 11 of 16
Step 3.(a) Run Concurrent Request Sona Throughput Report - All Org
The concurrent request Sona Throughput Report All Org is to be run from Inventory responsibility
Page 12 of 16
Step 2. (b) Next, mandatory, click Options Button and select Printer COPY from the LOV and input the
number of copy to 1 as shown in the screen shot below. This will enable the output file to be copied from
REPORT_DIR to UTL_FILE_DIR.
This step is required if email notification to users is to be sent. Incase email notification is not required, then
selection of printer is not necessary.
Page 13 of 16
Step3
Then we have to submit the concurrent request. Once Sona Throughput Report - All Org Concurrent is
completed normal, then automatically. Sona Throughput Report - All Org Email Notification concurrent
will run after 2 minutes. This is shown in the following screen shot.
Once the above concurrent is completed, then mail would be sent to designated users with Sona
Throughput Report - All Org Report Output as an attachment as shown in the following screen shot.
Finally, the concurrent Sona Throughput Report Schedule Concurrent needs to be scheduled daily in
order to get the output of the reports as per the following table:
Page 14 of 16
From Date
day of the month
th
08 day of the month
16th day of the month
24th day of the month
01st
To Date
day of the month
th
15 day of the month
23rd day of the month
Last day of the month
07th
Page 15 of 16
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
'COPY',
'BACS1',
1,
TRUE,
'N'
'INV',
--Application_Name
'SONATHRCSKG', --Short Name
NULL,
--Description
TO_CHAR(SYSDATE,'dd-mon-yy hh24:mi:ss'),
FALSE,
p_org_id,
--Argument
p_organization_id,
p_company,
p_set_of_books_id,
l_from_date,
l_to_date