Friday, August 5, 2011

Sending EMail After Report Code

FUNCTION AfterReport
RETURN BOOLEAN
IS
l_mail_reqid NUMBER;
l_to_mail_id VARCHAR2 (200);
l_cc_mail_id VARCHAR2 (200);
l_subject VARCHAR2 (225);
l_body VARCHAR2 (225);
l_file_path VARCHAR2 (100);
l_file_name VARCHAR2 (100);
l_file_disp VARCHAR2 (100);
BEGIN
l_to_mail_id := 'oracleapps88@gmail.com'; -- To Email Id
l_cc_mail_id := 'oracleapps88@gmail.com'; -- CC Mail
l_subject := 'XXX Process is completed at ' || SYSDATE;
l_body := 'Hi'; --\\\\nThe process XXX has completed and '|| 'attached is the Summary Report\\\\nThanks,\\\\nAnto';
l_file_path := '$APPLCSF/$APPLOUT';
l_file_name := 'o' || :p_conc_request_id || '.out';
l_file_disp := 'RFQ_Report.pdf';
srw.MESSAGE ('1', 'id:' || :p_conc_request_id);

-- Submit the request
l_mail_reqid :=
FND_REQUEST.SUBMIT_REQUEST ('XXCUST',
'SEND_MAIL',
NULL, -- Description (Optional)
NULL, -- Start Time (Optional)
FALSE, -- TRUE if this is to be child request
l_to_mail_id, -- Comma separated TO Email Ids
l_cc_mail_id, -- Comma separated CC Email Ids
l_subject, -- Subject of the mail
l_body, -- Body of the mail
NULL, -- Second part of body, if more than 225 Characters
l_file_path, -- File path
l_file_name, -- File to be attached
l_file_disp, -- Display name of the file
CHR (0),
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'');

IF l_mail_reqid <> 0
THEN
COMMIT;
ELSE
srw.MESSAGE (
'1005',
'Concurrent Request Submission for sending email failed!!!');
END IF;

RETURN TRUE;
END;

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect