File Download in a Report
Hi all
We use Oracle Apex 3.1...
in a Report while Downloading the File from the Report Out put,
the File is getting opened on the same Brower? instead of asking an Option to Save at location
Number / Date Format
DOWNLOAD:SMR:SMRFILE:ID:::SMR:::inline:Download
ANy idea Please
Good morning again,
Ok, sorry. I misread your original question. Typically, when that happens, the system does not know how to handle the file type you are trying to download. As such, you are asked for a save location and downloading to your hard drive is the default action.
If you have/know the mime type, you can include that information in your format string and the system should then know how to display the filetype you are trying to download.
Don.
You can reward this reply by marking it as either Helpful or Correct :)
Similar Messages
-
APEX 4.0: error while opening a XLS file downloaded from interactive report
Hi,
I'm getting below error while opening a XLS file downloaded from an interactive report (APEX 4.0).
"The file you trying to open, 'customer_2.xls', is in a different format than specified by the file extension.
Verify that the is not corrupted and is from a trusted source before opening file. Do you want to open file."
Yes No Help
May be this one Apex 4.0 issue.
please help me.
Thanks
MukeshHi,
is the next part of the code correct.
What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
You can also try below link..
Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
Hope this helps.
Regards,
-Sandeep -
TAx Reporter Temse Files Download Automation
Hi,
I have a reuiqrement to download the Temse files generated in Tax Reporter. I have completed the code and it works fine if we run the program in foreground. But when I run the same program in background some Temse files downloaded have junk characters. If I download the same Temse file in foreground it works fine.
There seems to be some issue with the FM when I run my progam in background.
I have searched SDN and SAP Notes for any clues but did not get any.
REPORT ZPHOP_TEMSE NO STANDARD PAGE HEADING
LINE-SIZE 1023
LINE-COUNT 65
MESSAGE-ID zz.
DATA: BEGIN OF tape OCCURS 1,
DATA(2000),
END OF tape.
DATA: force_ascii type c VALUE 'T'.
DATA: BEGIN OF int_msgs2 OCCURS 10,
errnum(2) TYPE c,
text1(8) TYPE c,
text2(60) TYPE c,
END OF int_msgs2.
DATA: BEGIN OF g_int_temse OCCURS 0,
dname LIKE TST01-dname,
dpart LIKE TST01-dpart,
dcretime LIKE TST01-DCRETIME,
dcreater LIKE TST01-DCREATER,
END OF g_int_temse.
DATA: record_length TYPE i VALUE 275,
data_length TYPE i,
convert_to_ebcdic,
filesize TYPE i,
number_of_records TYPE i VALUE 1,
filetype(3) VALUE 'BIN',
conv TYPE REF TO cl_abap_conv_out_ce,
dline TYPE REF TO data,
dtab TYPE REF TO data,
p_compid(4),
p_pswd(8),
g_str(2000),
uc_filename TYPE string.
DATA: l_nm_fixed_record.
CONSTANTS: c_lpath TYPE pathintern VALUE 'ZOUT'.
TABLES: TST01, ZPHOPFLS, ZTEMSE_LOG, V_5UXY_A.
FIELD-SYMBOLS: <dtab> TYPE STANDARD TABLE,
<dline> TYPE ANY.
INCLUDE: dbpnpcom. " No logical database Do not modify!
INCLUDE: zphoptop, " Top Include Do not modify!
zphopfil. " File inlcude Do not modify!
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-T01.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) text-001.
SELECT-OPTIONS s_temse FOR TST01-dname NO INTERVALS.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE text-T02.
SELECT-OPTIONS s_cai FOR TST01-DCREATER NO INTERVALS.
SELECT-OPTIONS s_date FOR sy-datum.
SELECTION-SCREEN END OF BLOCK B2.
SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE text-T03.
PARAMETERS: p_ifid LIKE t9aoa-if_id MODIF ID DIS ,
p_fileid LIKE t9aoa-file_id MODIF ID DIS,
p_unixf(60) LOWER CASE MODIF ID DIS,
p_uxdir TYPE pathextern LOWER CASE MODIF ID DIS,
p_dstfil(45) LOWER CASE MODIF ID DIS.
SELECTION-SCREEN END OF BLOCK B3.
PARAMETERS: p_skip AS CHECKBOX.
DATA: ws_unixr LIKE p_unixf,
ws_trans LIKE p_unixf.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'DIS'.
screen-output = '1'.
screen-input = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
INITIALIZATION.
p_ifid = 'PAYFLS'.
p_compid = 'HR00'.
p_fileid = '01'.
p_unixf = 'AFS'.
p_pswd = 'chevr123'.
p_skip = 'X'.
-End of Initialization--
PERFORM get_physical_path.
FORMAT COLOR COL_HEADING.
WRITE: /01 text-t04,
10 sy-pagno,
41 text-t05,
110 text-t06,
123 sy-datum.
WRITE: /01 text-t08,
14 sy-repid,
110 text-t07,
125 sy-uzeit.
FORMAT COLOR OFF.
SKIP.
WRITE: /(20) text-T21 CENTERED COLOR COL_HEADING,
(15) text-T22 CENTERED COLOR COL_HEADING,
(20) text-T23 CENTERED COLOR COL_HEADING,
(15) text-T24 CENTERED COLOR COL_HEADING,
(40) text-T25 CENTERED COLOR COL_HEADING.
START-OF-SELECTION.
*Do not allow background processing
*Check if the Temse file and CAI both are entered
IF NOT S_TEMSE IS INITIAL AND NOT S_CAI IS INITIAL.
MESSAGE W999 WITH TEXT-E01.
ELSEIF S_TEMSE IS INITIAL AND S_CAI IS INITIAL.
MESSAGE W999 WITH TEXT-E02.
ENDIF.
Collect all temse filenames from TST01 into an internal table.
IF NOT s_temse IS INITIAL.
SELECT dname dpart dcretime dcreater FROM TST01 INTO TABLE g_int_temse
WHERE dname in s_temse
AND dpart EQ '1'.
ELSE.
SELECT * FROM TST01
WHERE DCREATER in s_cai
AND DPART EQ '1'.
IF TST01-DCRETIME(8) GE s_date-low
AND TST01-DCRETIME(8) LE s_date-high.
MOVE-CORRESPONDING TST01 TO g_int_temse.
APPEND g_int_temse.
ENDIF.
ENDSELECT.
ENDIF.
SORT g_int_temse BY DNAME DPART DCRETIME.
LOOP AT g_int_temse.
Check if the temse file is already processed in ZTEMSE_LOG table.
SELECT SINGLE * FROM ZTEMSE_LOG
WHERE DNAME = g_int_temse-dname.
IF sy-subrc EQ 0.
error. Temse already processed
CONTINUE.
ENDIF.
Check if the temse file bieng processed is the eligible temse file
SELECT SINGLE * FROM V_5UXY_A
WHERE TSOBJ = g_int_temse-dname.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM ZPHOPFLS
WHERE TAXAU = V_5UXY_A-TAXAU
AND TXFRM = V_5UXY_A-TXFRM.
IF sy-subrc EQ 0.
Generate the filename for the target destination
CONCATENATE ZPHOPFLS-FILENAME '.' sy-datum '.' sy-uzeit INTO p_dstfil.
ELSE.
error. Script not maintained in ZPHOPFLS table
CONTINUE.
ENDIF.
ELSE.
error. Temse file is not the latest processed file.
CONTINUE.
ENDIF.
CALL FUNCTION 'RP_TS_OPEN'
EXPORTING
tsobj = g_int_temse-dname
versn = g_int_temse-dpart
empfg = 'RPUTSVUM'.
COMMIT WORK.
REFRESH tape.
CLEAR tape.
Einlesen von der TemSe
CALL FUNCTION 'RSTS_READ'
EXPORTING
PARTS1BY1 = 'X'
TABLES
datatab = tape.
CALL FUNCTION 'RSTS_CLOSE'.
Read the 1st line which is supposed to contains info important for
the downloading procedure. The syntax of the line is :
SAPxxxnnnyyyy - the 1st 3 char 'SAP' indicates this line contains
download related info. xxx can either be 'ASC' (for ASCII) or 'EBC'
(for EBCDIC). nnn is the length of each record, e.g. 128 for SSA disk
format, 275 for SSA tape format etc. yyyy can either be 'CRLF' (each
record is delimited by CRLF) or blank (no CRLF).
After processing the 1st line, the line is deleted from the internal
table. Downloading begins on the 2nd line.
READ TABLE tape INDEX 1.
IF tape-data(3) EQ 'SAP'.
IF tape-data+3(3) EQ 'EBC'.
convert_to_ebcdic = 'x'.
ELSEIF tape-data+3(3) EQ 'ASC'
AND force_ascii EQ 'T'.
filetype = 'ASC'.
ENDIF.
IF tape-data+6(3) NA '*'.
record_length = tape-data+6(3).
ELSE.
record_length = tape-data+13(4).
ENDIF.
IF tape-data+9(4) EQ 'CRLF'.
data_length = record_length + 2.
ELSE.
data_length = record_length.
ENDIF.
DELETE tape INDEX 1.
ELSE.
data_length = record_length.
ENDIF.
Transfer the Temse file data to Unix file.
PERFORM transfer_file.
Update the Log table with the temse details.
ZTEMSE_LOG-dname = g_int_temse-dname.
ZTEMSE_LOG-txcmp = V_5UXY_A-taxau.
ZTEMSE_LOG-txfrm = V_5UXY_A-txfrm.
ZTEMSE_LOG-filename = ws_unixr.
ZTEMSE_LOG-DCREATER = g_int_temse-dcreater.
INSERT ZTEMSE_LOG.
WRITE: /(20) ZTEMSE_LOG-dname,
(15) ZTEMSE_LOG-txcmp,
(20) ZTEMSE_LOG-txfrm,
(15) ZTEMSE_LOG-dcreater,
(40) ZTEMSE_LOG-filename.
ENDLOOP.
*& Form get_physical_path
Get Physical directory name for the given logical path name
FORM get_physical_path .
CALL FUNCTION 'ZFILE_GET_PATH_NAME'
EXPORTING
LOGICAL_PATH = c_lpath
IMPORTING
FILE_NAME_PATH = p_uxdir
EXCEPTIONS
PATH_NOT_FOUND = 1
MISSING_PARAMETER = 2
OPERATING_SYSTEM_NOT_FOUND = 3
FILE_SYSTEM_NOT_FOUND = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " get_physical_path
*& Form TRANSFER_FILE
FORM transfer_file.
p_unixf = 'AFS'.
Concatenate Date with Unix File name
CONCATENATE p_unixf '.' p_compid '.' p_ifid '.' sy-datum '.' sy-uzeit INTO ws_unixr.
Concatenate Unix Directory with Unix File for Outbound
CONCATENATE p_uxdir ws_unixr INTO p_unixf.
PERFORM open_files USING p_unixf.
LOOP AT tape.
g_str = tape-data(record_length).
TRANSFER g_str TO p_unixf LENGTH record_length.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error Transferring to: ' p_unixf.
ENDIF.
ENDLOOP.
PERFORM close_files USING p_unixf.
ENDFORM. " TRANSFER_FILE
Can anyone please check and tell me what I need to overcome this problem.Hi Bhaskar,
I also have the same requirement to upload TemSe files in to application server.
In FDTA tcode after we enter company code and click on enter.
In the second screen checking and line item and go to edit and click on download button.
Here we see a popup with default file name, and when we say ok the file will get downloaded into C:\.....
Here our req is to upload the file automatically pick up via batch job and place it in the in to the application server and from there it should be placed in the Netwrok server (UNIX).
Pls provide me with suitable code so that i can finish it off.I tried a lot but did not work.
Thanks. -
Report Print & Export Issue (File Download Box appears)
We send a URL to Crystal Enterprise which runs a script, logs on, finds folder, finds report and displays in the Crystal report viewer. All that works fine....
However, when you select the print icon or the export icon a Windows Internet Explorer box to select page range etc. and then when you say OK, you recieve a File Download Box asking to Open/Save/Cancel one of the following:
Print - Name: CrystalViewer.pdf, and Type of pdf_auto_file
Export - Name: CrystalViewer.rpt, and Type of CrystalReports
I have no IDEA what he is trying to do but he sure ain't printing. I can only assume that I have a missing part that he is trying to download at the time of print/export. Or that there is something set in the script that is killing me...
Sub ViewReport( iStore, id, token)
URI = "./viewer/en/viewreport.csp?id=" & id & "&token=" & token & GetPrompt
Set viewer = Server.CreateObject( "CrystalReports.CrystalReportViewer" )
Set rptFactory = iStore.EnterpriseSession.Service("", "PSReportFactory")
Set rptSource = rptFactory.OpenReportSource(CInt(id))
' Set the viewer's properties to prepare it for viewing.
With viewer
.ReportSource = rptSource
.EnterpriseLogon = iStore.EnterpriseSession
.URI = URI
.ISOWNPAGE = TRUE
.ISOWNFORM = TRUE
.HasPrintButton = TRUE
.ISDISPLAYPAGE = true
.isdisplaytoolbar = true
.isDisplayGroupTree = true
.GroupTreeWidthUnit = 1
.GroupTreeWidth = 17
.HasRefreshButton = true
.HasExportButton = true
.ParameterFields = GetParams
End With
If Err.Number <> 0 Then
'There was an error setting up the viewer.
Response.Write "<p>Unable to create report viewer. " & Err.number
Else
'Process the request and launch the viewer.
viewer.ProcessHttpRequest Request, Response, Session
'viewer.refresh
End If
End Sub
Help me???Please re-post if this is still an issue to the .NET Development - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly
-
Change File Name In The "File Download" Dialog Box For Web Reports
Hi All ,
I followed the below note to change the "File Download" name.
How To Change The File Name In The "File Download" Dialog Box For Web Reports? Doc ID: Note:418366.1
However its not working. Has anyone tried this and works fine ?
Basically I wanted to change the name "rwservlet" when a report is run in an
excel format.
Rajesh Alex
Rajesh AlexHello,
Have you checked if a HTTP header "Content-disposition" is returned ?
You can use ieHTTPHEaders for IE
http://www.blunck.se/iehttpheaders/iehttpheaders.html
and
Live HTTP Headers for FireFox
https://addons.mozilla.org/en-US/firefox/addon/3829
Regards -
"File download - security warning" when running a report
Hi all,
Few of our users are having an error on their PCs when trying to run a report in Internet Explorer 8 with Adobe Reader 10.1.3 installed on their PCs. The error is:
"File Download - Security Warning"
Do you want to save this file, or find a program online to open it?
Name: rwservlet
Type: Unknown File Type
Find Save Cancel
Other users are able to run the reports. They have IE8 and Adobe Reader 10.1.2 installed. Any ideas why this problem might occur?
Any help is appreciated.Hi,
what is the behavior if you leave adobe Reader opened and running before running the report?
Thanks, Roberto -
PDF Report file download problem
Hi,
I am using ApEx 3.1 and Oracle 10g and XSL-FO
I have a problem in downloading a PDF file:
(1) I have a report query (produced an xml file), report template, and report layout.
After I linked the new PDF report into my application, when I click on the button, the PDF “File Download” popup shows only two buttons (“save” and “cancel”) with a warning message “The file you are downloading cannot be opened by the default program. It is either corrupted or it has an incorrect file type. As a security precaution, it is recommended that you cancel the download”, and the file name shows up as “f.pdf”. I am able to open the saved file (f.pdf) in Adobe Acrobat and it looks fine.
(2) In “Home>Application Builder>Application xxx >Shared Components>Report Queries>Edit Report Query”, when I click on the “Test Report” button, the “File Download” popup shows with all three buttons, (“open”, “save”, “cancel”) --- it shows the correct name of the file, and, no warning message! At this point, the file can be opened with the “open” button”, or, be saved to the disk. The saved file opens with Adobe Acrobat and the contents are identical to that of the file “f.pdf”.
(3) I created another application (within the same workspace) with just one page, linked the PDF report in this application, and clicked on the button, and got the same response as in (2).
It looks like I could try to create a new application by copying page by page from the application quoted in (1), and see if that would solve the problem. It is time consuming, the outcome is uncertain, and also could create some other problems
What could be the cause of this problem? Any alternatives? I would appreciate any help.
Thanks
VasanWe experienced the exact same problem as the OP (including corrupt files named "f.pdf" and the browser dialog box he documented). Don't know if his environment is similar, but here is how we fixed our issue:
Our app uses an Authentication Scheme that includes under "Page Session Management" a "Session Verify Function" called like this: "return timeout_pkg.check_timeout;". This timeout_pkg I think came from code originally posted here, it works well so thanks to the original coder. However it does present a small issue in that it rewrites the mime headers in the server response in one use case. Since it is rewriting the headers to "text/html" even though we are sending back a report where the mime header should be "application/pdf", the client gets confused and the result is the symptoms the OP posted.
So if we change the timeout package and body so the signature is like this: "function check_timeout (p_request IN VARCHAR2 DEFAULT null) return boolean;"
And change the call in the "Session Verify Function" to pass the request as a parameter like: "return timeout_pkg.check_timeout(:REQUEST);"
And change the body of the timeout_pkg.check_timeout function to use the correct mime type when calling a report:
elsif not g_cookie_already_sent then
if (p_request is not null and INSTR(p_request, 'PRINT_REPORT') != 0) then
owa_util.mime_header('application/pdf', FALSE);
else
owa_util.mime_header('text/html', FALSE);
end if;
then we solve our particular problem... I hope this saves somebody else some time, remember this was our specific solution to the exact symptoms documented by the OP, however as a general rule I would say if you are experiencing problems with pdf printing from Apex, watch out for anything your app might be doing with the owa_util pkg in particular and mime headers in the server response in general.
Edited by: cmcneil on Sep 5, 2008 11:45 AM
Edited by: cmcneil on Sep 5, 2008 11:59 AM -
File download dialog box -running report
I am calling one report from my Oracle 9i Developer Suite Application. When i call one report using 'delimited' format, the run runs okay opening in a new Internet Explorer(IE) instance. But, when i call another report, the File download dialog box -running report opens which asks whether u want to open the file or save it in your computer. I hope, my doubt is clear.Please help me in this as it is very urgent.
Regards.This is a duplicate post. Please followup on your previous posting.
What is the URL you specify? -
After running csv report, open the 'File Download Dialog'
Hello,
I would like that, if I run a report, then I liked directly File Download Dialogue gotten.
How can i make this?
Thank you!can you give more details on how you call the report.
if you use url method to call , it will open the excel after the report is generated
when appropriate desformat is given -
Change download columns from report
Hi! I have a report, with some columns and I'd like to change the columns when downloading as csv file.
Let's say that I have a report with col1,col2, col3,col4 and some hidden columns: col5, col6, col7. When I download the file I'd like to have only
col2, col3, col6, col7.
How can I do this?
Thanks!Currently there is no way to do this. The CSV export function just re-runs the exact same report as you see it on the screen and transforms it to CSV format.
Another option is to create a report with the columns you want in the CSV on another page, and use the export:CSV template as in
http://tinypic.com/jzya2t.jpg
and provide a link to that page. This will run that page and instead of showing the page it will popup the File download box.
Hope this helps. -
Error opening PDF downloaded from Interactive Report
hi -- I'm getting an error opening a PDF file downloaded from an interactive report.
I've seen on the forum that this could be related to the size of the file, but I've tried
this out on 10-row results (1k files) and it's still an issue.
I save the file to my file system. If I try to open it in Adobe Reader, I get:
File does not begin with '%PDF-'
and
Adobe Reader could not open <filename>.pdf because it is either not a supported
file type or because the file has been damaged (for example, it was sent as an email
attachment and wasn't correctly decoded).
If I try to open in Internet Explorer, I get:
File does not begin with '%PDF-'
Other users are having the same problem. Download to csv and open in Excel works fine.
Do I need to have special print attributes for this? I didn't think so... I'm just using the defaults
(response header = report settings, content disposition = attachment).
Ideas?
Thanks,
CarolHi,
I'm having the same problem that was described above, and my site does have BI Publisher installed, and it does successfully produce readable pdfs for many reports.
But there are other reports, even reports produced using the Apex Wizard and all defaults, that just keep producing the same Adobe Reader error reported above, ie
"Adobe Reader could not open <filename>.pdf because it is either not a supported
file type or because the file has been damaged (for example, it was sent as an email
attachment and wasn't correctly decoded)."
Any suggestions?
Cheers,
Peter -
Unable to open PDF output (PDF downloaded from Interactive Report--APEX)
Hi,
I'm getting below error while opening a PDF file downloaded from an interactive report (APEX).
Adobe reader cound not open "TEST.pdf"because it is either not supportd file or because the file has been damaged.
Thanks & Regards,
Ramamuni.Steps of pdf Printing of Report from FOP:
1) Download and unzip the following needed files in D:\Apex_fop directory.
2) Open your command prompt .
Change the directory to D:\Apex_fop\cocoon-2.1.11.
Set the Java_Home environment variable as: set JAVA_HOME= C:\Program Files\Java\jdk1.5.0_21
then type build war
3) After getting the prompt back as D:>Apex_fop>cocoon-2.1.11>
Copy coocon.war file from the folder D:\Apex_fop\cocoon-2.1.11\build\cocoon.
Paste this file into webapps subdirectory in main tomcat directory having path as D:\APEX_FOP\apache-tomcat-6.0.26\webapps.....place it in the top
level of webapps directory.
4) Now just startup tomcat as D:>APEX_FOP>apache-tomcat-6.0.26>bin>startup.bat
The cocoon.war file will automatically uncompressed as directory.
5) To change the port of apache tomcat , edit apache-tomcat-6.0.26\conf\server.xml & change port attribute of Connector element from 8080 to 8181.
Just check whether Tomcat is running or not as http://localhost:8181/
& to check cocoon type http://localhost:8181/cocoon/
6) Now copy fop_post directory & paste it undes new cocoon directory in webapps having path as D:\APEX_FOP\apache-tomcat-6.0.26\webapps
\cocoon.
7) Now you need to do some apex settings as follows:
In APEX, just log in as ADMIN into apex/apex_admin and went to Instance Settings and did the following:
- Print Serverr: Standard Support
- Print Server Protocol: HTTP
- Print Server Host Address:localhost
- Print Server Port: 8181
- Print Server Script: /cocoon/fop_post
In your APEX application, in the Regions section, Click on the Print link next to your report and do the following settings:
- Enable Report Printing: Yes
- Link Label: Print
- Response Header: Report Settings
- View File As: Attachment
- Output Format: PDF
- Report Layout: Default Report Layout
- Print URL: f?p=&APP_ID.:1:&SESSION.:FLOW_XMLP_OUTPUT_R1063230002781575
8) Open up the Report Page and click Print , You will get the pdf report.
I am sure this will help you
Regards -
Hi ,
I am using web ui .
I have a requirement of converting an internal table to xml file & download it to application server .
I have converted the file to xml but not able to save the file to application server .I am currently using CL_CRM_FRONTEND_SERVICES=>GUI_DOWNLOAD method to download on application server , but it is throwing an exception of "flush" but at the same time if i am calling this method from a report through SE38, it is working fine .
Is there any other method that is to be used for CRM WEB UI to download a file on desktop / application server .
ManishGUI DOWNLOAD will not work in WebClient, as it is a completely different technology. You will have to use some kind of technology that uses HTTP. Just like in the Internet.
When you have got your content ready, maybe it is an option for you to transform it to XSTRING. There are some function modules in FM Group SCMS_CONV. Once you have got the XSTRING you can set it on a response object of class CL_HTTP_RESPONSE. Create a new one.
Now declare yourself an URL. In your viewcontroller you have got access to the variable RUNTIME.
concatenate runtime->application_url '/234234234.xml' into lv_url'
when you have both you can upload the content to the server cache:
cl_http_server=>server_cache_upload( url = lv_url response = lr_response ).
now you can access the content under the created URL lv_url.
On the BSP page you could for instance do this using javascript:
window.open( lv_url ).
This should open a dialog for the user with save option.
cheers Carsten -
I am using the following code to present a file to the client to download when a report is generated. The code does what is suppose to, it presents a dialog box where the user can choose to open, save, or cancel the file download. However, when the file is downloaded it contains the client HTML at the bottom of the saved file. I checked the created file on the server and it does not contain the HTML at the bottom, so it is being added by the following jsp code when the file is presented to the user. Any help would be appreciated. BTW, this running on HP-UX 11i using oracle forms 10G.
String RPT = request.getParameter("trig");
String SDATE = request.getParameter("start_date");
String EDATE = request.getParameter("end_date");
String PRN = request.getParameter("prn");
if(RPT != null)
try {
Runtime rt1;
Process proc1;
String[] doRefresh = {"/usr/bin/sh", "-c", "/usr/local/oracle/sql/st_tags/some_script '" + SDATE + "' '" + EDATE + "' '" + PRN + "'"};
rt1 = Runtime.getRuntime();
proc1 = rt1.exec(doRefresh);
int exitVal = proc1.waitFor();
String filename="/usr/local/oracle/sql/st_tags/temp/some_file.csv";
response.setContentType("application/octet-stream");
String disHeader="Attachment; Filename=some_file.csv";
response.setHeader("Content-Disposition", disHeader);
File fileToDownload=new File(filename);
InputStream in=null;
ServletOutputStream outs=response.getOutputStream();
try {
in=new BufferedInputStream
(new FileInputStream(fileToDownload));
int ch;
while((ch=in.read()) != -1) {
outs.print((char) ch);
finally {
if(in != null) in.close();
outs.flush();
outs.close();
in.close();
catch (Exception ignored) {}
}Sorry, wasn't sure how important the HTML portion would be. Thanks for the response. Here is the HTML that is before and after the afore mentioned code.
Before:
<%@page import="java.lang.*, java.net.*, java.util.*, java.io.*"%>
<%@page pageEncoding="UTF-8" contentType="text/html;charset=windows-1252"%>
<%@page language="java" import="mil.uspfo.dpi.*" errorPage="default.jsp" %>
<jsp:useBean id="AgnosticHostBean" class="mil.uspfo.dpi.AgnosticHostBean"
scope="session">
</jsp:useBean>
<base href="http://<% out.print(AgnosticHostBean.getHostNameProperty() ); %>
:7779/j2ee/">
<html>
<head>
<title>Master Report</title>
<link rel="stylesheet" type="text/css" href="styles/uspfo.css">
</head>
<body>
<%@ include file="header.html" %>
<h1>
Master Report
</h1>
<form name="mstr_form" method="post">
<p>Start Date:<input type="date" name="start_date">(example: YYYYMMDD)</p>
<p>End Date :<input type="date" name="end_date">(example: YYYYMMDD)</p>
<p>Payroll # :<input type="text" name="prn"></p>
<input type="SUBMIT" name="Button1" onClick="get_mstr_report()">
<input type="hidden" name="trig" size="2">
<br>
<script type="text/javascript">
function get_mstr_report() {
document.mstr_form.trig.value="go";
</script>AFTER:
</form>
<br>
<%@ include file="footer.html" %>
</body>
</html> -
Test for file download complete
Does anyone know an accurate way to test that a file download is complete? Reports are being brought down from a server and I want to know if the download is complete before I begin parsing the file.
Anyone know how to do this? Is File.canWrite() an accurate test?
Thanks,
MattOur server team initiates the download.Then you're out of luck. You can monitor the file size change over time, but it might as well be an incomplete or aborted download. I wouldn't know if a file that's written to will be blocked for reading. Might be, might not be. I'd say not, given my experience.
Maybe you are looking for
-
Ipad mini retina cannot share hot spot with Bluetooth for Iphon5
Ipad mini retina cannot share hot spot with Bluetooth for Iphon5 But When my Iphon5 share hot spot with Bluetooth for Ipad, I can share.
-
Messages won't deliver to one person
I'm trying to send a message to my friend who lives out of the country. It's not saying that my messages are being delivered. I tried everyone else on my contacts list and it works ok with them. Does this mean it's an issue with her phone? I've n
-
Driver class to test reading text file
I have a class to read text input from a text file one line at a time. I am having great difficulty writing a driver to text this class. Thanks Margaret // Class TextIO // required imports import java.io.*; class TextIO public static void fileRead()
-
How to eliminated sound of keyboard numbers?
how to eliminated sound of keyboard numbers?I configurated in sounds but,still when I need to dial a phone number. Model iphone3g
-
Is it possible to program a button to take the value of a field (the clients email) and send the form to that email and cc myself automatically? Thanks in advance for all of your help!