2007 Jun 21 3:05 PM
I have a file that I need to import into an internal table using FTP_SERVER_TO_R3. I want to make each row of the file as a text line and then use SPLIT to move content of row into fields. The size of each row is greater than 256 characters so I am unable to do . Is there any other way of doing this
TYPES: BEGIN OF text,
line(400) TYPE c,
END OF text.
chardata TYPE TABLE OF text WITH HEADER LINE.
2007 Jun 21 4:17 PM
Hi Megan,
Did you try as you mentioned above yet?
TYPES: BEGIN OF text,
line(400) TYPE c,
END OF text.
Are you trying to get a file from FTP server to R/3 or put a file from R/3 to FTP server? Perhaps it is better to use FM FTP_CONNECT and FM FTP_COPY instead which will work for both cases. These FM will not required internal table/file sizes. To put a file to FTP server, you need to create and save a file in application server.
Regards,
Ferry Lianto
2007 Jun 21 3:07 PM
Hi
Declare ur Report statement like this
Report <b>name of the program</b> line-size 400 line-count 25(3).
Regards
Ravi
2007 Jun 21 3:14 PM
The problem I have is each line is more than 256 characters
TYPES: BEGIN OF text,
line(256) TYPE c,
END OF text.
chardata TYPE TABLE OF text WITH HEADER LINE.
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
handle = hdl
fname = 'UPSImport.txt'
character_mode = 'X'
TABLES
text = chardata.
2007 Jun 21 3:19 PM
Hi,
Please try this.
TYPES: BEGIN OF text,
line TYPE STRING,
END OF text.
chardata TYPE TABLE OF text WITH HEADER LINE.
Regards,
Ferry Lianto
2007 Jun 21 3:20 PM
Hi,
when you import the data you can declare the internal table field with more than 256, nothing wrong in that. If you are facing problem with the Fm then you can use GUI_DOWNLOAD.
regards
Dj
reward for all useful answers.
2007 Jun 21 3:24 PM
Hi,
Its not that with characters limit, u can have more than 256, but check in ur file are there any separators.
Check the code below:
FORM upload_csv_file .
CLEAR gv_file.
gv_file = pa_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gv_file
filetype = gc_asc
has_field_separator = 'X'
TABLES
data_tab = gt_dummy
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 NE gc_zero_num.
MESSAGE i006.
LEAVE LIST-PROCESSING.
ENDIF.
Check if the input file is blank
IF gt_dummy[] IS INITIAL.
MESSAGE i007.
LEAVE LIST-PROCESSING.
ENDIF.
To remove quotes in the table
LOOP AT gt_dummy INTO gs_dummy. "#EC CI_LOOP_INTO_WA
gv_tabix = sy-tabix.
DO.
IF gs_dummy CA ','.
REPLACE ',' WITH '' INTO gs_dummy.
ELSE.
WRITE gs_dummy TO gs_dummy NO-GAP.
CONDENSE gs_dummy.
MODIFY gt_dummy INDEX gv_tabix FROM gs_dummy.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
ENDFORM. " upload_csv_file
Regards
Kannaiah
2007 Jun 21 3:49 PM
Ferry
When I use
TYPES: BEGIN OF text,
line type string,
END OF text.
The function module
CALL FUNCTION 'FTP_SERVER_TO_R3'
gives a dump, so line has to be of char type.
I cannot use
GUI_UPLOAD
as file is in another FTP server and not on the presentation server
Message was edited by:
Megan Flores
2007 Jun 21 4:17 PM
Hi Megan,
Did you try as you mentioned above yet?
TYPES: BEGIN OF text,
line(400) TYPE c,
END OF text.
Are you trying to get a file from FTP server to R/3 or put a file from R/3 to FTP server? Perhaps it is better to use FM FTP_CONNECT and FM FTP_COPY instead which will work for both cases. These FM will not required internal table/file sizes. To put a file to FTP server, you need to create and save a file in application server.
Regards,
Ferry Lianto
2007 Sep 17 1:11 PM
Hi Megan Flores,
I have the same problem as you once had.
I am using FM FTP_SERVER_TO_R3 to get the data from external application server.
Each line in the file has more than 900 characters but as you would have experienced it gets truncated from 256characters.
May I know how you have sloved this problem?
Thanking you in advance.