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

Uplaoding a file to external server using FTP

Former Member
0 Likes
502

hi,

i need to get the data from the internal table and then convert into a ASCII file format with ' | ' seperator...then i need to upload the file to the Server using FTP..

thanks in advance

jaideep

3 REPLIES 3
Read only

Former Member
0 Likes
454

HI Jaideep,

Use this function module to download data to the internal table.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = ws_c_nam " Assigning file path to where the report program to download

filetype = 'ASC' " Type of file Whether it is ASCII or BINARY

  • APPEND = 'X'

write_field_separator = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = i_report[] " Assigning internal table which contains report program

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22

.

    • If Download completes successfully then Operation Successful success message is displayed otherwise corresponding error id displayed

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

MESSAGE i000 WITH 'Operation Successful'.

ENDIF.

And refer these threads for Upload thru FTP,

http://sap.ittoolbox.com/groups/technical-functional/sap-dev/ftp-help-742555

Read only

jaideeps
Product and Topic Expert
Product and Topic Expert
0 Likes
454

hi sathiya,

i have done that...for example...this is my code..

tables spfli.

data itab type standard table of spfli with header line.

select carrid connid from spfli into corresponding fields of table itab.

output :

aa 12

bb 23 etc..here i need to add a sepeartor/delimiter such as PIPE symbol '|'...how to add this in the FM...

thanks

jaideep

Read only

0 Likes
454

Hi jaideep,

Use the following....

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = filestring

<b> write_field_separator = ','</b>

TABLES

data_tab = itab_data

EXCEPTIONS

to get the field separator .... in your case ' | '....

and then use the <b>'FTP_CONNECT', 'FTP_COMMAND', 'FTP_DISCONNECT'</b> function modules to send the file using FTP...

Hope that solves your problem!!

<b>*Reward Points if Useful*</b>

regards,

Naveenan.