on 2009 Feb 12 10:40 AM
Hi All
I have a file which is residing in Application Server [al11 tcode], how i can display the file using LinkToURL UI Element,
what is the path which i need give in the REFERENCE parameter of the UI Element.
Thanks in Advance
Regards
Chaitanya.A
Request clarification before answering.
closed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Any Idea
Thanks and Regards
Chaitanya.A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just becuase the file is in the filesystem of the application server, doesn't necessarily mean that it is exposed to the network at all. This really depends upon your OS and if you have a file share or external web server connected to the OS of your application server.
However if you want to temporarily create a URL via the ABAP application server for a file in the filesystem you can do so by placing the content into the ICM cache.
So you would read the file from the filesystem using the normal ABAP dataset commands.
Here is a small example where I am doing this with different image formats:
****Create the cached response object that we will insert our content into
data: cached_response type ref to if_http_response.
create object cached_response
type
cl_http_response
exporting
add_c_msg = 1.
* cached_response->set_compression( options = cached_response->IF_HTTP_ENTITY~CO_COMPRESS_IN_ALL_CASES ).
try. " ignore, if compression can not be switched on
call method cached_response->set_compression
exporting
options = cached_response->co_compress_based_on_mime_type
exceptions
others = 1.
catch cx_root.
endtry.
****set the data and the headers
data: l_app_type type string.
data: l_xstring type xstring.
case i_format.
when 'BMP'.
cached_response->set_data( me->gx_content ).
l_app_type = 'image/x-ms-bmp'.
when 'GIF'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/gif'.
when 'JPG'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/jpeg'.
when 'TIF'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/tiff'.
when 'PNG'.
me->get_content_ext_format(
exporting
i_format = i_format
importing
e_xstream = l_xstring ).
cached_response->set_data( l_xstring ).
l_app_type = 'image/png'.
when others.
raise exception type zcx_abap_bitmap.
endcase.
*
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = l_app_type ).
*
*
******Set the filename into the response header
* cached_response->set_header_field( name = 'Content-Encoding'
* value = 'compress' ).
****Set the Response Status
cached_response->set_status( code = 200 reason = 'OK' ).
****Set the Cache Timeout - 60 seconds - we only need this in the cache
****long enough to build the page and allow the IFrame on the Client to request it.
cached_response->server_cache_expire_rel( expires_rel = i_cache_timeout ).
****Create a unique URL for the object
data: guid type guid_32.
call function 'GUID_CREATE'
importing
ev_guid_32 = guid.
concatenate i_path '/' guid '.' i_format into r_url.
****Cache the URL
cl_http_server=>server_cache_upload( url = r_url
response = cached_response ).
Another option would be to create a custom ICF handler class. In this class you could pass the file name as URL parameters, read the content using ABAP DATASET commands and return the content in the response object.
Handler classes have to implement the IF_HTTP_EXTENSION Interface. You implent the method HANDLE_REQUEST.
Here is an example implementation of the HANDLE_REQUEST:
* Inform ICF to "keep" (reuse) this handler, and that we answered the HTTP request
if_http_extension~lifetime_rc = if_http_extension=>co_lifetime_keep.
if_http_extension~flow_rc = if_http_extension=>co_flow_ok.
* Determine image name from URL ~script_name/~path_info (= image_name)
data: name type string.
name = server->request->get_header_field( name = if_http_header_fields_sap=>path_info ).
translate name to upper case.
if strlen( name ) >= 1 and name(1) = '/'.
shift name left.
endif.
* Application logic
data: content type xstring.
content = me->load( name ).
if xstrlen( content ) is initial.
raise exception type cx_http_ext_exception exporting msg = 'Invalid URL!'.
endif.
* Set up HTTP response
server->response->set_status( code = 200 reason = 'OK' ).
server->response->set_header_field( name = if_http_header_fields=>content_type value = 'image/png' ).
server->response->server_cache_expire_rel( expires_rel = 86000 ).
server->response->set_header_field( name = if_http_header_fields=>cache_control value = 'max-age=86000' ).
server->response->set_data( content ).
3rd option would be to create an ICM File Handler. I detailed this functionality in the SAP Press book Advanced BSP Programming. It is covered in Chapter 16.2. Here is an exerpt:
The Internet Communication Manager (ICM) allows just such access to any file
system accessible to the underlying operating system. You can map operating file
system directories into ICM URL paths using the profile parameter icm/HTTP/
file_access_<xx>.
If you have never maintained one of the system-profile parameters, now is good
time to make friends with your Basis administrator. With the following additions
to our instance profile and a quick restart of the ICM, we are now able to access
file system directories via HTTP.
icm/HTTP/file_access_0 =
PREFIX=/doc/, DOCROOT=/usr,BROWSEDIR=2
icm/HTTP/file_access_1 =
PREFIX=/doc2/,
DOCROOT=
server\SAPPatches\Netweaver04,BROWSEDIR=2
In the first entry, we are just going to map to the local directory usr. We are able
to control the useru2019s options to browser a directory via the additional parameter
BROWSEDIR. The possible values are: 0 u2013 no browsing allowed, 1 u2013 only file names
are displayed, and 2 u2013 file names along with their size and last change date are displayed.
The second entry really shows off the power of this profile parameter. We are able
to expose a directory on a remote server via UNC paths. Of course the security on
that directory would have to be open to allow read-and-browse access. There is
also no real mechanism to apply security to the ICM URL for this file access node,
so you will want to be careful what you expose through it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas
I have created one profile parameter in RZ10 like
icm/HTTP/file_access_1 =PREFIX=/doc2/, DOCROOT=
HOST\<>\<>,BROWSEDIR=2
now what i need to do to retrieve the physical path of the file.
CONCATENATE
'\\'
sy-host
'\E$'
gv_phypath_a
lv_tmp_transid
lc_xml " '.XML'
INTO lv_file.
gv_phypath_a is a value returned by Function module FILE_GET_NAME_USING_PATH which returns Logical Path [FILE tcode]
lv_tmp_transid is the filename
lc_xml is a constant having .XML as value and is the extension of the file.
in lv_file i will get value like
<XXXDB>\E$\<interface\EBT>\<tid.xml>
how can i call the file with the above path
NOTE: Folder is NOT SHARED , its a normal folder
Best Regards
Chaitanya.A
You can't build a physical path that shoots off the drive share because everything you access must be relative to the directory prefix.
So as you access your file_access_1 the URL would have to being with
sy-host \ doc2 \ <whatever directory>
Think of doc2 as a share name for whatever endpoint you specify in DOCROOT.
User | Count |
---|---|
53 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.