‎2009 Nov 15 7:12 PM
HI,
I am trying to upload an asc file with tab delimited into an internal table. Unfortunately iam getting an "#" symbol in my last column of the itab. I am using the below code. Can some one tell me why iam getting the "#" symbol.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = dir
filetype = 'ASC'
has_field_separator = 'X'
IMPORTING
filelength = length
TABLES
data_tab = ITAB_FILE_DATA.
The content in the itab looks as below.
col1 col2
-
-
abc xyx123#
edf 98033#.
Thanks
Kuna.
‎2009 Nov 15 7:21 PM
Hello,
For the filetype parameter in your function try to use 'DAT' in stead of 'ASC'.
Although 'DAT' is not in the documentation of the function it should work.
GUI_UPLOAD is a newer version of WS_UPLOAD and there tab delimited files could be uploaded with filetype = 'DAT'.
Success !
Wim
‎2009 Nov 15 8:09 PM
hI,
I tried with "DAT" but still iam getting the same result.
‎2009 Nov 15 9:51 PM
the program that wrote that file need to download in ASC as well, then ASC download to ASC upload will match..
Update:The hash in the last character of a line is also called as line feed or carriage return...
Edited by: Jay Sadaram on Nov 16, 2009 9:35 AM
‎2009 Nov 16 12:13 PM
HI ,
While uploading a file from pC to server, the FM 'GUI_UPLOAD' is used.
In which one exporting parameter 'replacement exists, you have to comment this otherwise for the the non convertible characters it shows '#'.
use the following code for your refernce:
-
REPORT zuk_test_upload.
DATA : BEGIN OF itab OCCURS 0,
matnr(18),
meins(3),
maktx(40),
END OF itab.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\UKG.TXT'
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
replacement = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = itab
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.
LOOP AT itab.
WRITE:/ itab-matnr,itab-meins,itab-maktx.
ENDLOOP.
regards
Umakanth
‎2009 Nov 17 5:58 AM
Hi Venkat,
This is not a problem of your code, that perfect, the problem is your file content.
That '#' comes because of the the extra tab you had put into your file after the record end.
Remove that extra tab from end of the record and try again it will work.
Regards
Dhirendra
‎2009 Nov 19 10:00 AM
Hi i used the below function to remove the '#'
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = CURR1
IMPORTING
OUTPUT = CURR.