‎2005 Aug 19 6:51 AM
Hi guys,
Can any one pls help me how to upload file from one server to another server.Just for example i am retrieving data from a server and creating a file and this file need to be uploaded into another server.So can we do this......Pls help me ASAP.
‎2005 Aug 19 6:57 AM
Hi,
Here is a sample Code to upload a File from Presentation Server to Application Server.
DATA : BEGIN OF i_tab OCCURS 0,
line TYPE string,
END OF i_tab.
DATA: vfname TYPE string.
PARAMETERS : pa_flein(100) TYPE c, "File from Frontend
pa_fleot(100) TYPE c LOWER CASE."File on APP. Server
***********************************************************************
START-OF-SELECTION *
***********************************************************************
START-OF-SELECTION.
vfname = pa_flein.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = vfname
filetype = 'ASC'
TABLES
data_tab = i_tab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
BREAK-POINT. "Place appropriate message here
ENDIF.
Transfer File to appropriate Dest.
OPEN DATASET pa_fleot FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
BREAK-POINT. "Place appropriate message here
ELSE.
LOOP AT i_tab.
TRANSFER i_tab-line TO pa_fleot.
ENDLOOP.
ENDIF.
CLOSE DATASET pa_fleot.
Hope this helps you.
Thanks&Regards,
Ruthra.R
‎2005 Aug 19 6:59 AM
DATA :WRK_FILENAME TYPE STRING,
types: BEGIN OF TYP_FILE_DATA,
DATA(1000) TYPE C,
END OF TYP_FILE_DATA.
data: ITAB01_FILE_DATA TYPE TABLE OF TYP_FILE_DATA,
H_ITAB01_FILE_DATA LIKE LINE OF ITAB01_FILE_DATA.
*download data from one server
OPEN DATASET WRK_FILENAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
DO.
READ DATASET WRK_FILENAME INTO H_ITAB01_FILE_DATA.
IF SY-SUBRC = 0.
APPEND H_ITAB01_FILE_DATA TO ITAB01_FILE_DATA.
ELSE.
EXIT.
ENDIF.
ENDDO.
Upload to anothere one
OPEN DATASET WRK_FILENAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
LOOP AT ITAB01_FILE_DATA INTO H_ITAB01_FILE_DATA.
TRANSFER H_ITAB01_FILE_DATA TO WRK_FILENAME.
ENDLOOP.
ENDIF.
regds
gv
‎2005 Aug 19 7:00 AM
Hi,
Check these links.
http://www.sapgenie.com/abap/code/chap2604.txt
http://www.sapgenie.com/abap/code/chap2602.txt
Also check the documentation for FM GUI_UPLOAD and WS_UPLOAD.
GUI_UPLOAD Documentation:
Short text
Upload for data provider
Functionality
File transfer from frontend PC to an internal backend table.
A format conversion is possible. The functions are similar to the module WS_UPLOAD, however the data provider is used for the upload and not GMUX.
Example
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\DOWNLOAD.BIN'
tables
data_tab = itab.
loads the contents of the file 'C:\DOWNLOAD.BIN' on the frontend PC into the internal backend table itab. The transferred data is not converted.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'ASC'
filename = 'C:\DOWNLOAD.TXT'
tables
data_tab = itab.
loads the contents of the file 'C:\DOWNLOAD.TXT' on the frontend PC line by line into the internal backend table itab. The transferred data is converted.
‎2005 Aug 19 7:55 AM
I guess u didnt get my problem exactly.....I am creating a file in insurance server and need to upload the data in this file to FICO server.So can anybody help me out plssss....
‎2005 Aug 19 7:48 AM
‎2005 Aug 19 9:49 AM