Viewing a file which is in Application Server [al11]
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
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.
Similar Messages
-
Reading the data from excel file which is in application server.
Hi,
Iam trying to read the data from excel file which is in application server.
I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
I tried just reading using open data set and read data set it is giving junk characters.
Please suggest me if you have any solution.
Best Regards,
Brahma ReddyHi Narendra,
Please see the below code I have written
OPEN DATASET pa_sfile for INPUT in text mode ENCODING DEFAULT MESSAGE wf_mess.
CHECK sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
else.
split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
wa_upload-field34 wa_upload-field35 wa_upload-field36 .
wa_upload-field1 = wf_field1.
wa_upload-field2 = wf_field2.
append wa_upload to int_upload.
clear wa_upload.
ENDIF.
ENDDO.
CLOSE DATASET pa_sfile.
Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
Please suggest me any other way.
Thanks for your help,
Brahma Reddy -
How i access file which stored at application server .? Is there any fm ?
Hi,
How i access file which stored at application server . Is there any function module which provide same funtinality.
Regards,
Gurprit BhatiaHi ,
U need to use datasets for reading data from application server.Do a f1 on dataset,u will get to know rest of the things.
TRY.
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING UTF-8.
ENDTRY.
IF sy-subrc = 0.
READ DATASET file INTO <wa_data> MAXIMUM LENGTH 200.
move the data in to internal table
close dataset
Edited by: A kumar on Aug 21, 2008 1:37 PM -
F4 help for file path in the Application server
Hi All,
i want to provide the F4 help so as to enable us to give the file path in the application server (AL11). I'm in version 4.0
Regards
ShekharHi
Copy paste the following code and see the result
Here you can see 2 types of open dialogs
1. Directory View
2. File View
Use any one as per your requirement.
DATA : l_filetable TYPE filetable,
l_rc TYPE i.
DATA: l_folder TYPE string,
l_file TYPE string.
PARAMETERS: p_folder(100) TYPE c,
p_file(100) TYPE c.
*Provide a Dialogue box for getting a folder path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'Select Folder Path'
initial_folder = 'D:\'
CHANGING
selected_folder = l_folder.
p_folder = l_folder.
*Provide a Dialogue box for getting a file path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select a Text File'
initial_directory = l_folder
CHANGING
file_table = l_filetable
rc = l_rc.
Reward points generously
Regards
Akshay Chonkar
READ TABLE l_filetable INTO p_file INDEX 1.
CHECK sy-subrc <> 0. -
How to change the excel file name which is in Application server...
hi friends,
my requirement is getting failed, when i'm trying to change the file name which is in Application server using the FM: SXPG_COMMAND_EXECUTE.
when i execute above FM, i can see all my required details in SM69 like:
COMMAND NAME: ZSPOOL_TEST1
OS: Windows NT
TYPE: Customer
OS COMMAND: cmd rename Y:\OBRZ.PDF OBRZ38582.PDF
once the above FM is executed, i'm getting SY-SUBRC = 2 (exception: COMMAND_NOT_FOUND).
so, can any one guide me how to resolve this issue or is there any other way to rename the file which is in AS?
thanks in advance...Hi ,
First you can tranfer the AS server file to a new application server file.
Then you delete the original file .
To do that you can write code as follows --
DATA : w_file(8) TYPE c VALUE 'FILE_NAM', " your present AS file name
w_new(8) TYPE c VALUE 'NEW_FILE',
fs_itab(255) TYPE c,
t_itab LIKE TABLE OF fs_itab.
OPEN DATASET w_file FOR OUTPUT IN BINARY MODE.
DO.
READ DATASET w_file INTO fs_itab. " Reading value from the AS file to field string
IF sy-subrc NE 0.
EXIT.
ELSE.
APPEND fs_itab TO t_itab. " Populating internal table form the file value
ENDIF.
ENDDO.
OPEN DATASET w_new FOR INPUT IN BINARY MODE. " creating a new file if that does not exist
LOOP AT t_itab INTO fs_itab.
TRANSFER fs_itab TO w_new. " Transfering to file
ENDLOOP.
CLOSE DATASET w_file..
DELETE DATASET w_file. " Dleting the old file
CLOSE DATASET w_new. " Closing the final file
Regards
Pinaki -
How to retrieve data from an Excel file which is located on server
hi everybody,
I am using SAP NWDS 2004s .
I have done an application on how to export the table data into an Excel .
Now i want to get the data from an Excel file which is located in server and display that data which is in excel in a View for example a Sample view in Webdynpro .
In Sample view i took a uielement textview to display the data ....
can any one help how to procced further
Thanks in advance
MadhaviOptions to read Excel data to WebDynpro context
Reading Excel Sheet from Java without using any Framework
Reading Multiple Sheets of Excel Sheet from Java
Few Threads
How to Display the content of Excel file into Webdynpro Table
Is it possible to upload data from excel file(.xls)
Re: How to export the data as integer into excel sheet?
regards
Vinod -
How to store a JSP file in the SAP Application server ?
Hello All,
My reqt. is as follows :
1. I need to store a JSP File on the SAP Application server .
How can I do this ?
2. I want to call the uploaded jsp file from the server and call this jsp from abap to view the result of it .
How can I achieve this ?
First of all is this possible ?
Regards,
Deepu.KHello Mike,
Thanks for ur reply.
I've imported the JSP as a mime object into the BSP.
Now I've created the page to show that Mime Object as an image.
But nothing is coming as an output.
But then,there is an option for that mime object. i.e when I right click on the mime object there is an option called " convert to BSP".
I selected that option and it created a view in my BSP .( My BSP is a page with flow logic application )
Now how should i make this view to be an output ?
I guess this shud be posted in the BSP Forum ...but still taking a chance here :)-
Regards,
Deepu.K -
Files are stored in application server,
Files are stored in application server, I am using Open dataset to write to a file in unix box.would like to convert my itab into tab delimted and download. Please let know
is there any function?You should do a search to get the right ascii value (you can get an
ascii chart, you can google a bit, you can visit the group's page and
search for tab delimited... ) and replace 09 by the right value. And
that's it.. The technique (which is what it matters) is right.
Another tip:: you could download in two steps: first you use
gui_download or ws_download to create a tab delimited file in your pc or
in a network. Then you upload this file (using gui_upload or ws_upload
into an internal table and the final step is to use open dataset -
transfer - close dataset to write down this last itab to your app
server. -
Regarding the File Format on the application server
Hi,
I would like to know the file format (ANSI, UTF-8, UTF-16, UTF-32) of the file placed on the application server in my program. Can anyone help me with the Function Module or Class or any other way which will retrieve this information.
Thanks
Sarves S V KHi
You can try the standard class CL_ABAP_FILE_UTILITIES and the method
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = filename
IMPORTING
bom = file_bom
encoding = file_encoding.
Check the possible values returned by encoding and BOM:
NO_BOM
BOM_UTF8
BOM_UTF16_BE
BOM_UTF16_LE
ENCODING_UTF8
ENCODING_7BIT_ASCII
ENCODING_OTHER -
How to move PDF file from Spool to Application Server?
How to move PDF file from Spool to Application Server?
Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.Hi Gemini ,
Please refer the below links.
[http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
[http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM -
Creation of xml file in r3 application server (AL11)
Hi All
I need to create xml file in r3 application server (AL11) using PI.Can we achieve this using file adapter or we need to proceed with proxy. As I tried with file adapter with FTP transport protocol. Its giving the error as "Unable to create new pooled resource:FTPEx:Login incorrect".
Thanks in advance
Regards,
KartikeyaHi
need to create xml file in r3 application server (AL11) using PI.Can we achieve this using file adapter or we need to proceed with proxy.
To generate file at AL11 file directory use File adapter. Proxy is not required for this
Its giving the error as "Unable to create new pooled resource:FTPEx:Login incorrect".
1. Check with the Login credentials for the FTP service.
2. FTP User you use in communication channel must have 777 access to FTP location.
Thanks
Gaurav -
How to read list of all files in folder on application server?
How to read list of all files in folder on application server?
Hi,
First get the files in application server using the following function module.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
name = loc_fdir
TABLES
file_tbl = int_filedir.
Here loc_fdir contains the application server path.
int_filedir contains all the file names in that particular path.
Now loop at int_filedir.
OPEN DATASET int_filedir-name FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE wf_mess.
MESSAGE wf_mess.
IF sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
endif.
close datset int_filedir-name.
endloop. -
How to trigger a Report when a file is placed in Application server
Hi All,
How to triggger a Report and get executed when a new file is placed in the application server.?
It will be helpful if a Navigation is provided for the EVENT.
Thanks in advance
ChakriHi,
Check what is the frequency of the file coming to the application server.
Schedule your program in SM36 giving data and time make it periodic . select the check box Periodic Job
and then select the period values and give the period values as per the frequency of the file coming to app server.
Thanks,
Harini -
How to send the file contents in the application server to ftp server
Hi,
how to send the file contents in the application server to ftp server.
regards,
sreeTest SAP FTP functions
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = 'userid'
PASSWORD = MC_PASSWORD
HOST = 'servername'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
do some error checking.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Execute external commands (FTP Scripts)
The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
DATA: ld_comline
LIKE sxpgcolist-name,
ld_param LIKE sxpgcolist-parameters,
ld_status LIKE extcmdexex-status,
ld_output LIKE btcxpm OCCURS 0 WITH HEADER LINE,
ld_subrc LIKE sy-subrc.
REFRESH ld_output.
MOVE 'FTP_DATA_IN' to ld_comline. "Maintained using trans SM69
Execute external command, contained in 'ld_comline'
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = ld_comline
additional_parameters = ld_param "Params passed to script
operatingsystem
= 'UNIX'
IMPORTING
status = ld_status
TABLES
exec_protocol = ld_output
EXCEPTIONS
no_permission
= 1
command_not_found
= 2
parameters_too_long
= 3
security_risk
= 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry
= 13
jobcount_generation_error
= 14
OTHERS
= 15.
IF sy-subrc NE 0.
ENDIF. -
Upload a file to portal--- BW application server.
Dear All,
I have requirement where some part of business does not have SAP installed. But we would like to extract data from these business too.
So just wanted to know if we can have a scenario where user will upload the data to the portal (this is just a web portal). Can this be done?
Secondly, if the can be done, can we extract the file from portal to application server? From application then it becomes very simple to upload to data targets in BW.
Please help in this regard.
Thanks,
SandeepAssign an ID (e.g. 1234) to the uploaded file. You should abstract the store
so that it will work on the file system or in the database.
The JSP will include an image ref to that ID, e.g.
http://www.myco.com/myapp/imageservlet?id=1234
The image servlet will retrieve and stream the image. It has to set content
type etc. You should also verify that the current user has access to the
requested image if security/privacy is an issue.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com/coherence.jsp
Tangosol Coherence: Clustered Replicated Cache for Weblogic
"newsgroups.bea.com" <[email protected]> wrote in message
news:3daadaa5$[email protected]..
Imp struggling to find a way of uploading an image file from the browserto
the app server (wl 6.1), where the uploaded image will to be included as
part of a JSP file.
** Note
- this part of Managed Cluster, the uploaded directory is NFS mounted
between the managed servers
- we deploy using EAR's from the admin server.
I am able to upload but, cant get the uploaded image to display as partof
a JSP,
Our 5.1 WL server work perfectly using a standard exploaded directory !
I have logged this as a call at BEA, but they have not been able to offerme
a solution yet.
Regards
Roland
Maybe you are looking for
-
Country specific "Israel " not found while creating wage type in ECC 6
Hi While creating the wage type , I am not able to find Israel as a country in the drill down. Should this be taken as Others or what is the procedure when we are unable to find a country to select. Thanks Vardhini
-
My genius is not working with a few albums!
Ok.. so i bought the CD of Miley Cyrus' "The Time Of Our Lives" and Nick Jonas & The Administration's "Who I Am" and rippped them into my PC, filled the details, added album art and stuff. Then i updated my genius. but still genius is not detecting t
-
Creating a MaxLStatement to call a report script
I created a MAxl statement to call a report script to create a text file ouput. here's the syntax I am using export database appname.databasename using report file '\\\\servername\\dir\\Reportsc.rep' to data_file 'D:\\Hyperion\Essbase\\report.txt' Wh
-
Imac iSight external video adapter
My original display on the iMac iSight is damaged. I noticed the external video port and may I assume that I could use it to run it that way. But the problem is figuring which adapter to use. Somewhere is mentioned PN M9321 G/A and PN 9320 G/A but w
-
Upgrade Python to 2.7 in Sparc Solaris 11.2
Hi, Can anyone suggest a way to upgrade the Python from 2.6.8 in my Sparc Solaris 11.2 to 2.7+?