on 05-09-2006 2:24 PM
Hi,
In short: where (local path on application server) should I store a file (generated at runtime) in order to be able to offer it for downloading (via WAS)?
Context: I have a BSP application and I want to generate a PDF file (in the BSP app) and store that PDF locally on the server. In which local folder do I need to store that pdf so that it will be available remotely via WAS? Is there some folder in the local system that serves as WAS root folder?
Thanks!
Jeroen
Hi,
I wouldn't open the file system of the WAS for the public and let the WAS read the file itself and serve it to the client.
Eg
Open the file
OPEN DATASET file_path_pdf FOR input IN Binary mode message openmessage."text MODE encoding utf-8 .
if sy-subrc <> 0.
%>
<%=openmessage%>
<% mnavigation->response_complete( ).%>
<%
else.
read dataset file_path_pdf inTO pdfcontent.
CLOSE DATASET file_path_pdf.
endif.
Give it to the browser
runtime->server->response->set_data( pdfcontent ).
contentsize = xstrlen( pdfcontent ).
runtime->server->response->set_header_field( name = 'Content-Length'
value = contentsize ).
runtime->server->response->delete_header_field( name = 'Cache-Control' ).
runtime->server->response->delete_header_field( name = 'Expires' ).
runtime->server->response->delete_header_field( name = 'Pragma' ).
runtime->server->response->set_header_field( name = 'Content-Type'
value = 'application/pdf' ).
Eventual delet of the file
delete dataset file_path_pdf.
Set the reponse to complete to clear the buffers
mnavigation->response_complete( ).
Als take care when converting to PDF that you use unique file names in case you want to keep the files.
Eddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
By default nothing on the local file system is exposed via HTTP. You have to remember in productive ABAP systems, you often have multiple application servers (with separate file systems, and perhaps even a mixture of operating systems).
However you can setup an ICM File Handler. Lookup the documentation on the Profile Parameter icm/HTTP/file_access_X. You can map to local or remote directory.
Of course you can always read the data from the filesystem using OPEN DATASET, TRANSFER DATASET, Etc. and then expose the results via BSP as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.