Home » Developer & Programmer » Forms » To be E-mail Report directly Forms
icon5.gif  To be E-mail Report directly Forms [message #173396] Mon, 22 May 2006 05:04 Go to next message
mehulmb
Messages: 25
Registered: May 2006
Location: Pune
Junior Member

Respected Sir,

I have one problem regarding Report 6i. I want to send Report directly E-mail to given E-mail address through Forms 6i. What should I do...? Please understand it in details. Thanks....


Mehul
Re: To be E-mail Report directly Forms [message #173406 is a reply to message #173396] Mon, 22 May 2006 05:51 Go to previous message
adnanykhan
Messages: 4
Registered: May 2006
Location: PAKISTAN
Junior Member
begin
GO_BLOCK('BLK6');
first_record;
FOR I IN 1..10000
LOOP
Declare
Outlook_Object OLE2.OBJ_TYPE;
Mail_Object OLE2.OBJ_TYPE;
Item1 OLE2.OBJ_TYPE;
Item2 OLE2.OBJ_TYPE;
OLEPARAM ole2.list_type;
var_Send OLE2.OBJ_TYPE;
var_Attach1 OLE2.OBJ_TYPE;
var_Attach2 OLE2.OBJ_TYPE;
pl ParamList;
SUPCODE NUMBER(6);

BEGIN
if :blk6.stat = 'Y' THEN
begin
select i122_email into :global.email
from iv122sup
where i122_code = :sup_code;
exception when no_data_found then
null;
end;

set_application_property(cursor_style,'BUSY');
Outlook_Object := OLE2.CREATE_OBJ('Outlook.Application');
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'MAPI');
Mail_Object := OLE2.INVOKE_OBJ(Outlook_Object,'GetNameSpace',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

--newMail
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,0);
Item1 := OLE2.INVOKE_OBJ(Outlook_Object,'CreateItem',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

-- If you want to display outlook new message screen
ole2.set_property(Item1,'To',:global.email);
ole2.set_property(Item1,'Subject','Request For Quotation');
--synchronize;

-- If user has selected an attachment then add it with message.
BEGIN
pl := create_parameter_list('PList');
Add_Parameter(pl, 'PARAMFORM', TEXT_PARAMETER, 'NO');
add_parameter(pl,'SUPCODE',text_parameter,:sup_code);
add_parameter(pl,'destype',text_parameter,'file');
add_parameter(pl,'desname',text_parameter,'f:\RFQ.pdf');
add_parameter(pl,'desformat',text_parameter,'pdf');
run_product(reports,:global.loc||'application\iv\reports\iv900lcl.REP',synchronous,runtime,filesystem,pl,null);
destroy_parameter_list('PList');
END;

var_Attach1 := OLE2.GET_OBJ_PROPERTY(Item1,'Attachments');
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'f:\RFQ.pdf');
var_Attach2 := OLE2.INVOKE_OBJ(var_Attach1,'add',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

var_Send := OLE2.INVOKE_OBJ(Item1,'Send');
OLE2.RELEASE_OBJ(Item1);
OLE2.RELEASE_OBJ(Mail_Object );
OLE2.RELEASE_OBJ(Outlook_Object );
SET_APPLICATION_PROPERTY(CURSOR_STYLE,'DEFAULT');
END IF;
END;
IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
EXIT;
END IF;
next_record;
END LOOP;
Message('Mail sent successfully.........');
end;
Previous Topic: Percentiles in forms?
Next Topic: set 'update allowed' for all block in a form
Goto Forum:
  


Current Time: Fri Sep 20 06:38:33 CDT 2024