Professional Documents
Culture Documents
Periodic Alert:: Open The Alert Responsibility: Set Ur Application
Periodic Alert:: Open The Alert Responsibility: Set Ur Application
Periodic Alert:: Open The Alert Responsibility: Set Ur Application
7) Now the important step. Then click d Alert Details Button which is in the Alert home form. What r d the operating unit is used by d client. We must enter it.
Otherwise we will get a runtime error.
8) We r triggering the mail by using d Concurrent Program. Hence we must create the Executable.
9) Then create the Concurrent Pgm. (Note: the concurrent pgm must be register in d system administrator responsibility. Similar as we r registering 4 d
report. Here I am not include that screenshot. So don’t forget it. For example in this concurrent program I am registering in the recievables responsiblity)
10) Then click the parameter button.Here parameters we r specifying which is coming from action details argument.
11) Now write the package 4 firing the mail
Main Package:
tran_rec last_txn%ROWTYPE;
BEGIN
OPEN last_txn;
LOOP
FETCH last_txn
INTO tran_rec;
-- table detail
v_body := v_body || '<tr>' || v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_company_name || '</td>'
|| v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_customer_name || '</td>'
|| v_line_feed;
v_body :=
v_body
|| '<td>'
|| tran_rec.p_customer_number
|| '</td>'
|| v_line_feed;
v_body :=
v_body
|| '<td>'
|| tran_rec.p_ship_to_address
|| '</td>'
|| v_line_feed;
v_body :=
v_body
|| '<td>'
|| tran_rec.p_sales_order_number_date
|| '</td>'
|| v_line_feed;
v_body :=
v_body
|| '<td>'
|| tran_rec.p_trans_num_date
|| '</td>'
|| v_line_feed;
v_body :=
v_body
|| '<td>'
|| tran_rec.p_excise_invoice_date
|| '</td>'
|| v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_item || '</td>' || v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_description || '</td>'
|| v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_basic_price || '</td>'
|| v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_quantity || '</td>' || v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_division || '</td>' || v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_sales_person || '</td>'
|| v_line_feed;
v_body :=
v_body || '<td>' || tran_rec.p_sales_rep_id || '</td>'
|| v_line_feed;
v_body := v_body || '</tr>' || v_line_feed;
END LOOP;
IF last_txn%ROWCOUNT = 0
THEN
-- The cursor fetched no rows.
-- send email using utl_smtp
THEN
IF p_sales_rep_id IS NOT NULL
THEN
SELECT email_address /*this column has multiple values like ‘mail1@gmail.com,mail2@gmail.com….etc’*/
INTO v_recipient
FROM ra_salesreps_all
WHERE salesrep_id = p_sales_rep_id;
CLOSE last_txn;
END con_program_alert_email;
END fine_last_transction;
/
v_message :=
'Date: '
|| TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
|| v_crlf
|| 'From: <'
|| p_sender
|| '>'
|| v_crlf
|| 'Subject: '
|| p_subject
|| v_crlf
|| 'To: '
|| p_recipient
|| v_crlf
|| 'Cc: '
|| cc_parties
|| v_crlf
|| ''
|| v_crlf
|| p_message;
UTL_SMTP.data (v_mail_conn, v_message); --it will display in the to address like date,sender,receiver,cc persons
UTL_SMTP.quit (v_mail_conn);
EXCEPTION
WHEN OTHERS
THEN
UTL_SMTP.close_connection (v_mail_conn);
END send_e_mail;
END fine_last_trans_cust;
/ it will look like the below screen shot
Final Output: