Create a file
Hi,
I just would like to create a file, which the user can download.
Scenario:
The user choose some options on the JSF-page. Then a database query will execute. The user should be able to download that data of the query as a .csv file.
So how should I handle that scenario?
The created file should only exists for the user-request. So how and when should I delete these temporary files?
It would be great if someone could help me!
So I've tested. Unfortunately it doesn't work :-/
I've just received a NullPointerException. Something with the "ResponseWriter" is wrong. I can't write anything in that writer.
After the NullPointerException I received the "test.csv "-File. But the content is just the whole page (where the CommandLink was pressed) with all HTML-Tags.
May someone could help me again please?
My implementation:
In the JSP-page i've got a commandLink with the action:
<h:form>
<h:commandLink value="download" action="#{bean.actionDownload}" />
</h:form>In the bean i've got the methode actionDownload:
public String actionDownload()
FacesContext ctx = FacesContext.getCurrentInstance();
if( !ctx.getResponseComplete() )
try
String strMIME = "text/plain";
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
response.setContentType( strMIME );
response.setHeader( "Content-Disposition", "attachment;filename=\"" + "test.csv" + "\"" );
ResponseWriter writer = ctx.getResponseWriter();
writer.writeText( "test", null ); // <-- java.lang.NullPointerException
writer.flush();
ctx.responseComplete();
catch (IOException e)
System.out.println("IO-Fehler bei createCSV...");
e.printStackTrace();
catch (Exception e)
System.out.println("Allg. Fehler bei createCSV...");
e.printStackTrace();
return null;
}
Similar Messages
-
Error while creating control file
hi
i am getting following error while creating controll file
QL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 629145600 bytes
Fixed Size 1250548 bytes
Variable Size 171969292 bytes
Database Buffers 452984832 bytes
Redo Buffers 2940928 bytes
SQL> @c:\study\rose\c.sql
SP2-0042: unknown command "DATAFILE" - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "CHARACTER ..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
1 CREATE CONTROLFILE SET DATABASE "ROSE" RESETLOGS froce logging NOARCHIVELOG
2 MAXLOGFILES 32
3 MAXLOGMEMBERS 2
4 MAXDATAFILES 32
5 MAXINSTANCES 16
6 MAXLOGHISTORY 1752
7 LOGFILE
8 GROUP 1 'C:\oracle\product\10.2.0\oradata\rose\LOG1ROSE.ORA' SIZE 50M,
9 GROUP 2 'C:\oracle\product\10.2.0\oradata\rose\LOG2ROSE.ORA' SIZE 50M,
10 GROUP 3 'C:\oracle\product\10.2.0\oradata\rose\LOG06.LOG' SIZE 25M,
11* GROUP 4 'C:\oracle\product\10.2.0\oradata\rose\LOG07.LOG' SIZE 25M
SQL>CHETAN YADAV wrote:
hi
i am getting following error while creating controll file
QL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 629145600 bytes
Fixed Size 1250548 bytes
Variable Size 171969292 bytes
Database Buffers 452984832 bytes
Redo Buffers 2940928 bytes
SQL> @c:\study\rose\c.sqlWe can't debug what we can't see. And what we can't see is the contents of "c:\study\rose\c.sql".
SP2-0042: unknown command "DATAFILE" - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "'C:\ORACLE..." - rest of line ignored.
SP2-0734: unknown command beginning "CHARACTER ..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
1 CREATE CONTROLFILE SET DATABASE "ROSE" RESETLOGS froce logging NOARCHIVELOG
2 MAXLOGFILES 32
3 MAXLOGMEMBERS 2
4 MAXDATAFILES 32
5 MAXINSTANCES 16
6 MAXLOGHISTORY 1752
7 LOGFILE
8 GROUP 1 'C:\oracle\product\10.2.0\oradata\rose\LOG1ROSE.ORA' SIZE 50M,
9 GROUP 2 'C:\oracle\product\10.2.0\oradata\rose\LOG2ROSE.ORA' SIZE 50M,
10 GROUP 3 'C:\oracle\product\10.2.0\oradata\rose\LOG06.LOG' SIZE 25M,
11* GROUP 4 'C:\oracle\product\10.2.0\oradata\rose\LOG07.LOG' SIZE 25M
SQL> -
Hi All,Error while creating a file in EMIGALL
Hi All,
When am creating a File name in Data import screen.
The process which i had done is :
I had copied the Migration object DEVICE from std SAP to my company ZTEST and generated the report for this from menu option Migration object --> Generate Report . After that i had selected the option Data import from the same menu option .
In the Data import screen i had selected radibutton Batch Wrork porc and in the Import file tab i had given the file name as DEVICE.ZDE and pressed the create .When i pressed create the following message is appearing :
"Error Opening the file DEVICE.ZDE" .
if I see the detailed help it is showing the following message :
Error opening file DEVICE.ZDE
Message no. EM022
Diagnosis
File DEVICE.ZDE could not be opened.
Procedure
Check the file name and ensure that the file is not being used in another way.
pls provide me the solution for the above Issue ASAP.
regards,
BharatHi Bharat,
First of all make sure that Device file is of .txt with tab deliminated format, before uploading this file please close this file and try. Still if you are facing the same problem then let me know.
Regards,
Shailesh -
How to populate a table instaed of creating a file
Hello Everybody,
I have been thinking if any of you has ever done simmilar thing..
I have a crontab task that runs a script that gathers some space statistics each month from couple of servers..and sends an output to a file..
how to redirect that output so it populates certain table in the database?
can you recomend best approach?
thanks a lot,
agat81The easiest way would be to create your file in a way that it will look like
insert into your_table_name values (bla, 1,2 ,3);
insert into your_table_name values (blub, 4,5 ,6);
commit;
Then execute the script with sqlplus from cron.
cu
Andreas -
Can't create a file using fm 'File_Get_Name'
hi gurus,
Can you please help me with this issue. There's a program that have to create a file using the said fm. It was working before when it was set in OS NT. But when the settings and codes have been changed to UNIX, the program was able to generate the program. But the file doesn't exist. It seems it doesn't create a file in that server.
What else do I need to check?
Points will be rewarded. Thanks
Here's the code for your reference:
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
* CLIENT = SY-MANDT
logical_filename = 'Z_SYSBRIDGE'
OPERATING_SYSTEM = SY-OPSYS
* PARAMETER_1 = ' '
* PARAMETER_2 = ' '
* USE_PRESENTATION_SERVER = ' '
* WITH_FILE_EXTENSION = ' '
* USE_BUFFER = ' '
IMPORTING
* emergency_flag =
* file_format =
file_name = ltfile-out_path
EXCEPTIONS
file_not_found = 1
OTHERS = 2.Hi Maui,
Did you check SM69, where the code that ties to this FM creates a file after it execute your FM...
SM69 are os commands that does UNIX execution or other OS commands...
or maybe you have missed another FM like FM 'SXPG_OS_COMMAND' or of some sort.
Thanks
William Wilstroth -
Hi Experts,
I have created the logical path and filename in FILE tcode.I am trying to upload the pdf file to application server by using this path.But
I am getting message like "Unable to open the file".Even I cannot find the this path in AL11 tcode.Kindly anyone advise how to upload pdf file using
custom path and file created from FILE tcode.
Thanks & Regards,
Anusha.Hi Anusha,
Please give as below.
I forget to say you cannot open the PDF in AL11 and for that you need some configuration, i think it can be done using content server,not sure completely please wait for some more suggestions.
Regards,
Pavan -
We have a Java7 web app, which generate PDF report by calling Crystal Server 2013 SP4.
The app is being deployed on many different servers. We sometimes got the error below when generating report:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Can not create temp file---- Error code:-2147215357 [CRSDK00000615] Error code name:internal
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.controllerExportInternal(PrintOutputController.java:280)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(PrintOutputController.java:152)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(PrintOutputController.java:130)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(PrintOutputController.java:113)
Problem is, this seems to be a pretty generic exception. It could be caused by many different reasons.
e.g. network connection problem, wrong DB login, wrong folder path, lack of folder access right, etc.
Each time we could only guess what's wrong.
We are running into it again, and this time everything seems correctly configured so far.
We wonder if there are more info we can get to troubleshoot? For example, any log file of Crystal Server we should look into? Or does Crystal Server has debug mode which prints more details to tell us what goes wrong?Prithviraj Shekhawat wrote:
Hi Henry,
I believe you are using RAS SDKs to export the reports to PDF.
Apply trace on RAS server and check what you find in RAS logs.
Check whether you can see timeout error is RAS logs. Usually if connection is lost and the RAS server no more have the session to write to the temp directory, we do see these errors.
Also, does the account that runs RAS have permissions to create a file in RAS's default temp directory? Are you getting any out of memory or out of disk space exceptions on App server or RAS, tracing RAS server is the way to move forward.
Thanks,
Prithvi
>>I believe you are using RAS SDKs to export the reports to PDF.
Yes
>>Apply trace on RAS server and check what you find in RAS logs.
>>Check whether you can see timeout error is RAS logs.
How to configure tracing, and where are RAS logs? Is it configured in CMC --> Servers --> Crystal Report Services?
>>Also, does the account that runs RAS have permissions to create
>>a file in RAS's default temp directory?
Pretty sure yes.
>> Are you getting any out of memory or out of disk space exceptions
>>on App server or RAS, tracing RAS server is the way to move forward.
Not on App server.
For RAS, that's the problem, I am not sure where to look....... -
Hello,
While exporting Export reporting from BI4 getting exception
Can not create temp file---- Error code:-2147215357 [CRSDK00000615] Error code name:internal
In Trace Log I am getting
com.crystaldecisions.xml.serialization.XMLWriter||Failed to create an object instance for CrystalReports.TextObjectFormat
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key CrystalReports.TextObjectFormat
at java.util.ResourceBundle.getObject(ResourceBundle.java:374)
at java.util.ResourceBundle.getString(ResourceBundle.java:334)
I tried following solution according to the all forums but still issue exist.
Done changes mention in KB article In <Installation-dir-of-BO>\Common\4.0\java\CRConfig.XML we have to increase the JAVA heap MIN and Max size
<JVMMaxHeap>64000000</JVMMaxHeap> <JVMMinHeap>32000000</JVMMinHeap>
Increase the value in the ReportApplicationServer Services in the CMC for "Number of database records to read when previewing or refreshing a report". The value -1 is for unlimited records but not recommended for performance.
Check for temporary read write permission on server
Using SDK library from C:\Program Files (x86)\SAP Business Objects\SAP BusinessObjects Enterprise XI 4.0\java\lib
Can you please let me know is there anything missing.Hi,
We face the same problem with some BI4 reports.
The same report works well with the "Crystal Reports Viewers API", as used in Infoview, but not with the "Report Application Server (RAS) API".
This error appears after some time working on a report. If we reproduce the same report, but from zero, no problem.
Hope it can help.
Ludovic. -
After upgrade to CF9, CFIMAGE "Unable to create temporary file" error
We recently upgraded from CF8 to CF9 Enterprise. I'm getting an "Unable to create temporary file" error on
my CFIMAGE resize calls. We use sandbox security. I assume I need to grant write access to whatever folder CF uses for temp files, but which folder is it? The same code (and sandbox settings) ran fine in CF8....
Note, if I attempt to add C:\JRun4\servers\cfusion\SERVER-INF\temp to the sandbox for this particular app, CF crashes on all requests across all apps on the server with a:
Security: The requested template has been denied access to C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfclasses\cfapp2ecfc1510154633.c lass.
The following is the internal exception message: access denied (java.io.FilePermission C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfclasses\cfapp2ecfc1510154633.c lass read)
ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.
I need to restart CF to get everything working again.Another update. Had a problem with a sandboxed CF9 site doing a simple CFIMAGE READ to a memory variable. Got an "Unable to create temporary file" error.
Inserted the following code in the file upload page:
<cfscript>
writeoutput("Temp Dir : " & createobject("java","java.lang.System").getProperty("java.io.tmpdir") );
</cfscript>
... and it reveals the temp directory as C:\WINDOWS\TEMP. Added that to the sandbox, and the CFIMAGE READ is working properly now.
Note this seems inconsistent with CFIMAGE RESIZE behavior which appears to use the CF GetTempDirectory() value, which in my case is C:\JRun4\servers\cfusion\SERVER-INF\temp\cfusion-war-tmp\
For reference, see the section "Sandbox Considerations" at this link:
http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fc8 .html#WSc3ff6d0ea77859461172e0811cbf364104-7fcc -
Rep-0118:Unable to create temporary file error in Report Builder
I have installed Report Builder (latest edition) for windows 2000 server, but my users on windows XP cannot create the report it gives them
Rep-0118:Unable to create temporary file error
Please help me out
VijayYou have to change registry settings by going through REGEDIT. Under hkey_local_machine/software/oracle/<oracle home>, look for variable REPORTS_TMP. Change value for this, for example c:\windows\temp or something like that where you want oracle reports to create temp files.
-
How to create xml file through SDK?
Hi,
I need help in creating the xml file using SAP B1 SDK?
i want to create xml file which is in tally xml format.
Warm Ragards,
MahendraHi Mahendra,
This is an example to save a form as XML :
try
System.Xml.XmlDocument oXmlDoc = null;
string sXmlString = null;
oXmlDoc = new System.Xml.XmlDocument();
// get the form as an XML string
sXmlString = Form.GetAsXML();
// load the form's XML string to the
// XML document object
oXmlDoc.LoadXml(sXmlString);
string sPath = null;
sPath = System.IO.Directory.GetParent(System.Windows.Forms.Application.StartupPath).ToString();
sPath = System.IO.Directory.GetParent(sPath).ToString();
// save the XML Document
oXmlDoc.Save((sPath + @"\Form" + sType + ".xml"));
//oXmlDoc.Save(DIRECTORY_TEMPLATE + "Form" + sType + ".xml");
catch (Exception ex)
SBO_Application.MessageBox("ERROR in 'SaveAsXML()' : " + ex.Message, 1, "Ok", "", "");
And an example to navigate in the XML file :
System.Xml.XmlDocument xxml;
System.Xml.XmlNode node;
System.Xml.XmlNodeList nodes;
xxml = new System.Xml.XmlDocument();
xxml.LoadXml(oRecAU.GetAsXML());
nodes = xxml.SelectNodes("BOM/BO/IFC_AU/row");
foreach (System.Xml.XmlNode node in nodes)
oColumn.ValidValues.Add(node.SelectSingleNode("Code").InnerText, node.SelectSingleNode("Name").InnerText);
I hope it's help you.
Regards
Michael -
We are installing SAP R3 4.7 sr1 on Linux SuSE SLES9, 32/bit.
Problem: During the installation of DI, phase Database Load (Pst Processing), installation stopped , and in the log file said
Could not create task file tmp/sapinst_instdir/.../SAPREPOS.TSK
Anyone with the similar problem? Solution?
Best regards,
Igor KokaiHello:
I do not know exactly what of the following elements contributed to fix the problem, but
following is the list of changes we did in a 3rd try to install R/3 on Sun Solaris.
1. Get latest SAPINST.
2. Use a different installation directory, which is permitted by the use os a new SAPINST. We used something outside /tmp, which is used by default by the SAPINST that comes with the CDs.
3. Delete the whole installation and start again, because by just using SAPINST in the middle of the installation, the problem was not fixed.
4. Change the SID from DEN to DE1.
5. There was an answer in sdn about the problem telling a linux user to use another environment variable that was for HP-UX, but since it was suggested for them, we took it, just in case. That was also done in the middle of the installation when the problem was happening, but did not fix the problem.
6. We did not install the oracle patch 9.2.0.7 because the patch is the one that looks for a bunch of sun patches, that although we already had them, since the error we were getting was oracle related, it was decided not to do that for now.
7. Smile and go ahead without desperation.
Regards,
Juan -
How to Create Excel File in Background processing with different colors
HI All
I am trying to create Excel file in background & send it to user through e-mail, this i could acheive using fucntion module SO_DOCUMENT_SEND_API1, but here my requirement is i want to put different colors to columns of excel & this should happen in Background processing,
Initially i completed above requirement by using HTML type of document with attachment type 'ALI' & formatted output using write statement & used colors, after that i took this o/p using save_list function module & then table compress...etc.
but i don't know how to achieve same if we need o/p in excel as size of object of excel file is less than that of HTML
I am thankfull to everybody who will help me.
Regards
LokeshLokesh,
Iam also trying to populate my text file with colors as an attachment . If you know this please let me know. -
Problem while creating JAR file for my swing application
Hi...
Using my swings application I am trying to Run different software�s .
My program is Running fine from command prompt. If I create JAR file
It is giving error like �Failed to load Main-Class manifest attribute from .jar�
Can anybody help me to creating JAR file
Thanks in advance
Cheers
Mallikhi,
User following command
jar-cmf textfile_name.txt Jarfile_name *
here you have to make manifest file
and making jar file you have reach there by command promt
and manifest file have some constraint also as well as format
format are
Manifest-Version: 1.0
Class-path: jar file name which are using in app separed by space
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: Main class name
and end of file is not have carriage return -
I am trying to copy text from a word document and paste it into my web builder and it says that firefox does not support copy/paste from clipboard. Went to your site and it tells me to open the user.j file in my profile. This file does not exist and I am not real sure how to create that file so I can paste the fix from your site into it.
I went to that link and added to firefox add on but it still does not work. I went to the add on option button for this but it told me that my MYSIWG widget was disabled. Does this have something to do with it not working and if so how do you enable it.
-
F110 Automatic Payment: Create payment file and create remittance
Hello,
I'd like to know the steps to create payment file and remittances in Automatic payment process (F110).
Thanks in advanceHello Emanula,
payment medium entries are customized in "payment method Country details". You have to decide whether you want to use the PMW or the classical paymentprogram.
The paymentadvices are generated from the paymentprogram by using the parameters from the CC-data of the paymentmethod - Box "Payment advice control".
At least: Don't forget to maintain the parameters in f110 "Printout/data medium"
Hope this gives you a help.
Best regards
Horst
Maybe you are looking for
-
Workflow - AVCHD to DVD but without optimised footage?
I am an enthusiast and I have a few Panasonic prosumer camcorders with which I shoot basic AVCHD and ultimately I burn DVDs - which people tell me look just fine. When importing I have "Leave files in place" checked and I create Proxy files ONLY as o
-
I probably should have read a little before starting this. What is the Adobe procedure for finding content that is supposed to be included, like library in Encore, but is missing.
-
Hello, I wanted to report a bug in iOS 5.1 and higher (found on an iPhone 4 and an iPod touch 4th generation) Here is something about the problem: Summary: When you try to uninstall an Application by clicking on the "X", Springboard will crash. Steps
-
Trying to salvage iCal data after hard disk failure!
Hi all, I had a major hard disk failure recently, and also discopvered that my regular backups weren't including my iCal data! Eek! All that info I use for tax records gone! Anyway, the wonderful DiskWarrior managed to salvage a drive that was not vi
-
Hi, Im trying to put a background on my page. I have the Pages 5.1. I can't send the image at the back and lock it. Can someone help me. Thanks