‎2008 Jun 23 6:07 PM
Hi folks,
I am using 'UPLOAD' FM to upload a text file into the internal table from the presentation server. I have two text files that exactly identical. The file layouts, strucutre are the same only the data is different. The interesting thing is the first file is getting uploaded into the internal table, while the second no data is coming through. I have thoroughly checked the two files, there is no difference in the two.TXT files.
Here is the code...
CALL FUNCTION 'UPLOAD'
Exporting
filename = 'C:\HOA_ABC.txt
filetype = 'DAT'
Tables
data_tab = itab
.....
What can be the reason for this? Is there a problem with 'UPLOAD" FM ?
I have used this FM quite often and works fine, I am unable to discover what might be wrong in the second file?
Let me know,
Thanks,
VG
‎2008 Jun 23 6:10 PM
hi,
r U trying to upload the 2 files in the same prog?
If so, I suggest check clearing/ refreshing internal tables/ variables before the FM is used 2nd time.
Rgds,
Raghu.
‎2008 Jun 23 6:11 PM
hi,
Refresh itab data before you upload the second file ...
i.e,
REFRESH ITAB. Regards,
Santosh
‎2008 Jun 23 6:14 PM
Hi Vinu,
Try using the FM "GUI_UPLOAD".
call function 'GUI_UPLOAD'
exporting
filename = filename
filetype = filetype
has_field_separator = has_field_separator
header_length = header_length
read_by_line = read_by_line
dat_mode = dat_mode
codepage = codepage
ignore_cerr = ignore_cerr
replacement = replacement
virus_scan_profile = virus_scan_profile
importing
filelength = filelength
header = header
tables
data_tab = data_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.
case sy-subrc.
when 1.
raise file_open_error.
when 2.
raise file_read_error.
when 3.
raise no_batch.
when 4.
raise gui_refuse_filetransfer.
when 5.
raise invalid_type.
when 6.
raise no_authority.
when 7.
raise unknown_error.
when 8.
raise bad_data_format.
when 9.
raise header_not_allowed.
when 10.
raise separator_not_allowed.
when 11.
raise header_too_long.
when 12.
raise unknown_dp_error.
when 13.
raise access_denied.
when 14.
raise dp_out_of_memory.
when 15.
raise disk_full.
when 16.
raise dp_timeout.
when others.
raise unknown_error.
endcase.
endif.
&***************<removed_by_moderator>*******************&
PS: I will start removing points from now onward...
Edited by: Julius Bussche on Jun 23, 2008 11:01 PM
‎2008 Jun 23 6:30 PM
No. I am uploading them one by one. Is the FM not very consistent one? I upload the first file that goes fine The second one comes up with this wierd stuff. Anyway going forward I believe should use GUI_UPLOAD that can take different formats.
I shall take a look inot it. Thanks for the reply.
VG
‎2008 Jun 24 12:32 AM
check this sample code for gui_upload, you can have ASC.. BIN.. modes...
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
dat_mode = ''
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = i_text_data
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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
‎2009 Jan 30 2:32 PM