Home » Developer & Programmer » Reports & Discoverer » Excel file generation (Reports 11g, Windows 2012 Server)
Excel file generation [message #656647] Thu, 13 October 2016 02:46
saiphani723
Messages: 38
Registered: July 2006
Location: Hyderabad
Member
In AFter report trigger I created a logic for the excel file generation...

File is generating in the server successfully, in the folder which i specified.

But my problem is i want to copy the file from server to the client machine where report generated.

I tried to attached webutil.pll to the report and using the WebUtil_File_Transfer.AS_to_Client i try to download the file

compile time i am not getting any error, but in the run time i am getting the following error.

"ORA-06508: PL/SQL: could not find program unit being called "

find the attached file with my code

function AfterReport return boolean is

Cursor C1
Is
Select 	AgentCode,AGentName,Transdate,
				Docref,Description,CurrencyCode,
				DebitAmount,CreditAmount,
				Amount,CummulativeAmount,
				FromDate,REMARKS
From Temp_FGACC033
Order By CurrencyCode, Transdate;				
				
Lvfile Text_IO.File_Type;
LvServerPath	Varchar2(20) := 'E:\Tmp\';
LvFileName		Varchar2(30);
LvServerFileName		Varchar2(30);
LvFileExtension		VarChar2(100);

begin
	LvFileName	:=	'E:\FGACC033-'||'-'||To_Date(Sysdate,'dd-mm-yyyy hh24miss')||'.TXT';
	LvServerFileName	:=	'FGACC033-'||'-'||To_Date(Sysdate,'dd-mm-yyyy hh24miss')||'.TXT';
  Lvfile := Text_IO.FOpen('E:\Tmp\FGACC033-'||'-'||To_Date(Sysdate,'dd-mm-yyyy hh24miss')||'.TXT','w');
  Text_IO.Put_Line(Lvfile,'AGENTCODE,AGENTNAME,TRANSDATE,DOCREF,DESCRIPTION,CurrencyCode,DEBITAMOUNT,CREDITAMOUNT,AMOUNT,CUMMULATIVEAMOUNT');

  For C1Rec In C1
  Loop
		Text_IO.Put_Line(LvFile,C1Rec.AgentCode||','||C1Rec.AGentName||','||C1Rec.TransDate||','||C1Rec.DocRef||','||C1Rec.Description||','||C1Rec.CurrencyCode||','||C1Rec.DebitAmount||','||C1Rec.CreditAmount||','||C1Rec.Amount||','||C1Rec.CummulativeAmount);
  End Loop;
  /*Lvfile := Text_IO.FOpen('E:\FGACC033-'||'-'||To_Date(Sysdate,'dd-mm-yyyy hh24miss')||'.TXT','w');
  Text_IO.Put_Line(Lvfile,'AGENTCODE	AGENTNAME	TRANSDATE	DOCREF	DESCRIPTION	CurrencyCode	DEBITAMOUNT	CREDITAMOUNT	AMOUNT	CUMMULATIVEAMOUNT');

  For C1Rec In C1
  Loop
		Text_IO.Put_Line(LvFile,C1Rec.AgentCode||'	'||C1Rec.AGentName||'	'||C1Rec.TransDate||'	'||C1Rec.DocRef||'	'||C1Rec.Description||'	'||C1Rec.CurrencyCode||'	'||C1Rec.DebitAmount||'	'||C1Rec.CreditAmount||'	'||C1Rec.Amount||'	'||C1Rec.CummulativeAmount);
  End Loop;*/

	Text_IO.FClose(LvFile);
		Srw.Message(1,'File Name  -------->'||LvFileName);
		Srw.Message(2,'server path  -------->'||LvServerPath);
			Srw.Message(1,'server File Name  -------->'||LvServerFileName);
		Srw.Message(3,'File Extension  -------->'||LvFileExtension);
		Begin
			If WebUtil_File_Transfer.AS_to_Client(
    									LvFileName,															-- Client Machine path/file
    									LvServerPath||LvServerFileName				-- Server Machine path/file
    									) Then
					If Upper(LvFileExtension) In ('PDF','HTM','HTML','TXT') Then
    				--Host('Del '||LvServerPath||LvFileName);
    				Null;
    			End If;
    			Srw.Message(10,'Download successfull......');
    		Else
    			Srw.Message(11,'Download Not successfull......');
    		End If;
    		Exception
    			When Others Then
    				Srw.Message(1,'Error while downloading the file....'||SqlErrm);
    		End;		
 --  	WEBUTIL_HOST.Host('xcopy \\BKICAPP11\Tmp\FGACC033--10-10-2016.txt \\pcho-266\Tmp'); 		
  return (TRUE);
end;


[mod-edit: contents of attachment inserted into message with code tags by bb]

[Updated on: Thu, 13 October 2016 21:07] by Moderator

Report message to a moderator

Previous Topic: Upgrading Oracle8i to Oracle Database 10g Enterprise Edition
Next Topic: Export format
Goto Forum:
  


Current Time: Mon Oct 19 18:25:22 CDT 2020