‎2007 Feb 27 3:34 AM
Dear my friends,
I am using GUI_UPLOAD function to upload a file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename contain file path
FILENAME = filepath
filetype is ASC
FILETYPE = 'ASC'
Use tab key to seperate field
HAS_FIELD_SEPARATOR = ','
Internal table keep data from file by function GUI_UPLOAD
TABLES
data_tab = tblTrantable.
but it did not work for HAS_FIELD_SEPARATOR option.
although i tried to use HAS_FIELD_SEPARATOR = '#'
but system still return by fix lengh data column not by separator.
<u>note : my SAP version = 4.6C</u>
Please help me,
Thanks !
Message was edited by:
Quoc Luc Nguyen
Message was edited by:
Quoc Luc Nguyen
‎2007 Feb 27 3:37 AM
hi,
try specifying 'X' for has field separator parameter. or try calling ws_upload
‎2007 Feb 27 3:37 AM
hi,
try specifying 'X' for has field separator parameter. or try calling ws_upload
‎2007 Feb 27 3:39 AM
can you mention the error that you have got when using this function
‎2007 Feb 27 3:41 AM
hi,
set has field separartor to 'x'.
chk this FM for example:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = W_FILENAME1
FILETYPE = W_FILETYPE1
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'X'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_UPLOAD
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.
regards,
keerthi
‎2007 Feb 27 3:48 AM
‎2007 Feb 27 3:50 AM
Dear my friends,
i have tried many times, but it still seprate column by fix lengh which is defined on internal table.
for ex : my data file contain
Column1,Column2,Column3
internal table :
types : begin of Trantable,
GLAccount(10) type C,
Amount(13) type C,
TaxCode(2) type C
end of Trantable.
when i write data after upload
result always :
GL Account = Column1,Co
Amount = lumn2,Column3
TaxCode =
this mean, system separate by fixlenght, not by separator
‎2007 Feb 27 3:53 AM
Hi Quoc ,
What is the saperator you are using in the file ,
Regards
Arun
‎2007 Feb 27 4:00 AM
Dear my friend,
first time, i am use TAB for separator but it did not work.
so, now i am using COMMA for separator but it still does not work
thanks !
‎2007 Feb 27 4:04 AM
‎2007 Feb 27 4:15 AM
Hi Quoc ,
Use a tab delimited file and use the following statement
<b> HAS_FIELD_SEPARATOR = '#'</b> in you r FM. This will work.
Here is a sample code for the same
types : begin of Trantable,
GLAccount(10) type C,
Amount(13) type C,
TaxCode(2) type C,
end of Trantable.
Data : it_1 type table of trantable ,
wa_1 type trantable.
data : v_file type string.
v_file = 'c:arun.txt'."File Name
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '#'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = it_1.
* 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 it_1 into wa_1.
endloop.Regards
Arun
‎2007 Feb 27 4:03 AM
Hi quoc,
specify the seperator as 'X',it will work.
HAS_FIELD_SEPARATOR = 'X'
‎2007 Feb 27 4:12 AM
Dear my friends,
thanks your time so much,
I have tried on two different SAP server,
it work on one SAP server but it does not work on other.
so, i don not know the reason.
is there any special setting on other server !?
thanks !
‎2007 Feb 27 4:24 AM
Dear my friends,
Is there any function with the same feature with GUI_UPLOAD,
may be, i will try other function
thanks !
‎2007 Feb 27 4:44 AM
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
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 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
<b>Upload Tab delimited file from PC into internal table</b>
Refer this link
‎2007 Sep 05 12:15 PM
hi,
You should try with 'X' !
HAS_FIELD_SEPARATOR = 'X' .
Regards,
Mehfuze