Muhammad Nadeem Chaudhry's Blog


Send Report via EMail Attachment in Oracle Forms 10g

Posted in Uncategorized by Muhammad Nadeem Chaudhry on May 31, 2013

DECLARE
report_id REPORT_OBJECT := find_report_object(‘MYREPORT’);
report_message VARCHAR2(100) :=”;
rep_status VARCHAR2(100) :=”;
v_error Exception;
thelist paramlist;
BEGIN
— Create parameters list
thelist:= Get_Parameter_List(‘rep_paramlist’);
IF NOT Id_Null (thelist) THEN
DESTROY_PARAMETER_LIST(thelist);
END IF;
thelist := Create_Parameter_List (‘rep_paramlist’);

— Add report paremeters
ADD_PARAMETER(thelist, ‘FROM’,TEXT_PARAMETER, ‘abc@abc.com’);
ADD_PARAMETER(thelist, ‘SUBJECT’,TEXT_PARAMETER, ‘MRF NO:’||:GLOBAL.SIFNO);
ADD_PARAMETER(thelist, ‘PROJECT_NBR’,TEXT_PARAMETER, 968404);

— Set report object properties
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME, ‘C:\workingDirectory\MRF.RDF’);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER, ‘rep_XP_oracleasFRM’);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, MAIL );
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT, ‘PDF’);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,’paramform=no mrfno=’||:GLOBAL.SIFNO);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESNAME,’abc@abc.com’ );

— Check report status
report_message := run_report_object (report_id, thelist);
rep_status := report_object_status (report_message);
BEGIN
WHILE
rep_status in (‘RUNNING’,’OPENING_REPORT’,’ENQUEUED’)
LOOP
rep_status := report_object_status(report_message);
END LOOP;
EXCEPTION
WHEN v_error then
message(‘Error in sending Action Checklist email.’|| rep_status);
END;
END;

One Response to 'Send Report via EMail Attachment in Oracle Forms 10g'

Subscribe to comments with RSS or TrackBack to 'Send Report via EMail Attachment in Oracle Forms 10g'.

  1. Rehan said,

    I have try this but it show error “FRM-41213 UNABLE TO CONNECT TO THE REPORT SERVER”


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: