on 08-22-2009 6:06 AM
Hi experts,
File content is XSTRING after using file upload UI element to upload a local .txt file, then how can I transfer the XSTRING content to application server and realize the file copy between local work station to application server?
You can use function module ARCHIVFILE_CLIENT_TO_SERVER to upload files. Note SE37 will capitalize your filename and path, but you can set a breakpoint in the FM and change the ijnput parameters back to lower-case if necessary.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> You can use function module ARCHIVFILE_CLIENT_TO_SERVER to upload files. Note SE37 will capitalize your filename and path, but you can set a breakpoint in the FM and change the ijnput parameters back to lower-case if necessary.
You can not use ARCHIVFILE_CLIENT_TO_SERVER within Web Dynpro ABAP. It uses SCMS_UPLOAD with the importing parameter FRONTEND hardcoded to 'X'. This will cause the upload from the client to occur with an RFC call to SAPFTP. This RFC call will try to connect via the SAPGUI with the SAPFTP option - which will fail in Web Dynpro ABAP since there is of course no connection to the SAPGUI.
HI,
This is the piece of code to upload file to app server.
data lv_output_length type i.
data ls_solix type solix-line.
data lt_solix_tab type table of solix-line.
data lv_filename type string.
data lv_docnum type doknr.
*write a temp file on app server
1. create File name of the uploaded file on app server
concatenate '/usr/sap/' sy-sysid sy-uname sy-datum into lv_filename.
*2. convert xstring to binary : pass the XSTRING received from UI Upload element
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = lv_filesource " this is the XSTRING of the file u want to upload
importing
output_length = lv_output_length
tables
binary_tab = lt_solix_tab.
3. write the file
if not lt_solix_tab is initial.
open dataset lv_filename for output in binary mode.
loop at lt_solix_tab into ls_solix.
transfer ls_solix to lv_filename.
endloop.
close dataset lv_filename.
endif.
The file <Lv_filename> will be created on the app server.
Thanks,
Abhishek
Edited by: abhishek sinha on Aug 22, 2009 10:10 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.