Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with uploading files to application server

Former Member
0 Likes
605

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.

6 REPLIES 6
Read only

Former Member
0 Likes
574

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

Read only

Former Member
0 Likes
574

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

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
574

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.

Read only

0 Likes
574

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....

Read only

andreas_mann3
Active Contributor
0 Likes
574

Hi Mavrick,

have a look to taht link:

Andreas

Read only

0 Likes
574

Plss help me if anybody have a slighest idea about this