Home » Developer & Programmer » Forms » Calling a parameterised report from forms and emailing automatically
Calling a parameterised report from forms and emailing automatically [message #225211] Mon, 19 March 2007 03:02 Go to next message
Sidhant
Messages: 5
Registered: November 2006
Junior Member
Dear Members,
I hv created an application in forms which calls a report by passing the parameter
and automatically e-mailing the report by using pre-configured ms outlook.
My application is running on developer 20006i, oracle 9i Rel 2. Its a client server architecture.
But iam facing a problem..the mail initially goes for the first time but then it doesn't work subsequently..
Pl can any one tell me the problem or some additional methosds or alternatives..
the code i have given below...
................................

DECLARE
PL_ID PARAMLIST;
BEGIN
------ data updation in tables ------
UPDATE DEALER_DESP_DATE SET START_DATE=:da_change.text_start, END_DATE=:da_change.text_end,
CUSTOMER_CODE=:da_change.cust_code;
COMMIT;
---------- executing report ---------
pl_id:=null;
Run_Product(REPORTS,'D:\STL_FINAL\EMAIL_BOX\CUSTOMER_DESP_MAIL',SYNCHRONOUS,RUNTIME,FILESYSTEM,PL_ID, NULL);
END ;
------ email operation starts here -----------
Declare
objOutlook OLE2.OBJ_TYPE;
objMail OLE2.OBJ_TYPE;
objArg OLE2.LIST_TYPE;
l_body_txt varchar2(4000);
OLEPARAM OLE2.LIST_TYPE;
Attachments OLE2.OBJ_TYPE;
Attachment_dummy OLE2.OBJ_TYPE;

BEGIN
objOutlook := OLE2.CREATE_OBJ('Outlook.Application');
objarg := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(objarg,0);
objMail := OLE2.INVOKE_OBJ(objOutlook,'CreateItem',objarg);
OLE2.DESTROY_ARGLIST(objarg);
OLE2.SET_PROPERTY(objmail,'To',:da_change.mail_id);
OLE2.SET_PROPERTY(objmail,'Subject','Despatch Report');
l_body_txt := 'Pls find attached the detail despatch report for the period from ';
l_body_txt := l_body_txt ||:da_change.text_start||' to '||:da_change.text_end;
l_body_txt := l_body_txt ||' Thank you, R K Mishra';
OLE2.SET_PROPERTY(objmail,'Body',l_body_txt );
--attachments
Attachments := OLE2.GET_OBJ_PROPERTY(objmail,'Attachments');
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'D:\STL_FINAL\EMAIL_BOX\dealer_desp.htm');
Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);

OLE2.INVOKE(objmail,'Send');
OLE2.INVOKE(objmail,'Display');
OLE2.RELEASE_OBJ(objmail);
OLE2.RELEASE_OBJ(objOutlook);
End;
message('Mail sent successfully');
message(' ');

regards,
Re: Calling a parameterised report from forms and emailing automatically [message #225682 is a reply to message #225211] Tue, 20 March 2007 23:51 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do you get an error message? Do you know on which line the code fails?

David
Previous Topic: D2kwut32.dll
Next Topic: HOW TO create a temp table or a record group at run time
Goto Forum:
  


Current Time: Thu Dec 05 17:11:01 CST 2024