Home » Developer & Programmer » Reports & Discoverer » Sending reports as attachment through email (Reports 6i)
Sending reports as attachment through email [message #302534] Tue, 26 February 2008 01:15 Go to next message
dillango
Messages: 145
Registered: January 2008
Senior Member
Dear All,

I have problem sending the reports directly to a email from Oracle REports


The below codes working fine when I execute report, generate into PDF document and then coming back
to Forms and press the PUshbutton,where the below code written in when-button-pressed trigger.

My query is:

1) How to invoke this code in report itself
2) It is not sure that the user will generate the same file name and the path where I mentioned in the the program.
3) When I use the default mail option provided by the report itself, It is opening yahoo web site through IE.


Regards, ILANGO


---Written in push button

DECLARE

OutlookApp OLE2.OBJ_TYPE;
NameSpace OLE2.OBJ_TYPE;
mailItem OLE2.OBJ_TYPE;
OLEPARAM OLE2.LIST_TYPE;
Send OLE2.OBJ_TYPE;
Attachments OLE2.OBJ_TYPE;
Attachment_dummy OLE2.OBJ_TYPE;
var1 varchar2(200);

Begin

--assign a value to the variable from the Oracle Form
-- var1 := :BLOCK5.txt5;

--but for testing, populate the variable 'by hand'
var1 := 'Test message from REports';

OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');

OLEPARAM := OLE2.CREATE_ARGLIST;

OLE2.ADD_ARG(OLEPARAM,'MAPI');
NameSpace := OLE2.INVOKE_OBJ(OutlookApp,'GetNameSpace',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);

OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,0);
mailItem := OLE2.INVOKE_OBJ(OutlookApp,'CreateItem',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);

--OLE2.SET_PROPERTY(mailItem,'To','joe.leibowitz@afosr.af.mil');
OLE2.SET_PROPERTY(mailItem,'To','xyz@email.com');
OLE2.SET_PROPERTY(mailItem,'Subject','Sample message from reports');
OLE2.SET_PROPERTY(mailItem,'Body', 'Hi'||var1);

--add an attachment

Attachments := OLE2.GET_OBJ_PROPERTY(mailItem,'Attachments');
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'D:\test.pdf');
Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);

Send := OLE2.INVOKE_OBJ(mailItem,'Send');

--destroy objects
OLE2.RELEASE_OBJ(mailItem);
OLE2.RELEASE_OBJ(NameSpace);
OLE2.RELEASE_OBJ(OutlookApp);

END;

Re: Sending reports as attachment through email [message #322416 is a reply to message #302534] Fri, 23 May 2008 07:48 Go to previous message
sirfkashif
Messages: 70
Registered: September 2007
Location: Rawalpindi
Member
only if you still did't find the solution to your problem
then here's the solution, put the above mentioned code in after report trigger of report for 1st point.
for 2nd point i would suggest to save files in pdf in a pre-specific format which you can use as attachment file name in above mentioned code
for 3rd point open the internet explorer properties and on programe tab select microsoft outlook as default email.

regards,
Kashif Ali
Previous Topic: Discoverer Viewer NULL Parameter Value
Next Topic: change report direction
Goto Forum:
  


Current Time: Sun Jun 30 11:57:00 CDT 2024