06-19-2006 5:02 PM
Hi when i upload an XML file using this function module with BIN format,some special characters which are not convertible by the functional module are replaced by # in the internal table.How to get rid of this #?
I want to change it into space.
I tried to use REPLACE statement but that is useless in my case.
loop at itab into wa_itab.
replace all occurences of '#' in wa_itab-tdline with space.
if sy-subrc = 0.
conditions
endif.
endloop.
my sy-subrc is returning 4.
Can anybody help me?
06-19-2006 5:09 PM
is it tab delimited file..?
loop at itab into wa_itab.
replace all occurences of <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB</b> in wa_itab-tdline with space.
if sy-subrc = 0.
conditions
endif.
endloop.
Regards
vijay
06-19-2006 5:05 PM
The # must be a new line or a tab.
so you should actually scan and replace for CL_ABAP_CHAR_UTILITIES->New_line or CL_ABAP_CHAR_UTILITIES=>horizontal_tab
loop at itab into wa_itab.
replace all occurences of CL_ABAP_CHAR_UTILITIES->New_line in wa_itab-tdline with space.
if sy-subrc = 0.
conditions
endif.
endloop.
Regards,
Ravi
06-19-2006 5:06 PM
06-19-2006 5:09 PM
is it tab delimited file..?
loop at itab into wa_itab.
replace all occurences of <b>CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB</b> in wa_itab-tdline with space.
if sy-subrc = 0.
conditions
endif.
endloop.
Regards
vijay
06-19-2006 5:23 PM
hi Suresh,
Use this statement
<b>replace all occurences of CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in wa_itab-tdline with space.</b> i guess it works
Regards,
Santosh
06-20-2006 6:53 AM
hi
With the help of u people some # were removed and there are # at the last of the last line, i expect them to be empty spaces, how to get rid of them
06-20-2006 7:07 AM
in fm.. gui_upload.
HAS_FIELD_SEPARATOR = ' '.
not
HAS_FIELD_SEPARATOR = 'X'.
06-20-2006 8:15 AM
Hi,
for that last line use the following , probably that '#' is new line.
loop at itab into wa_itab.
replace all occurences of <b>CL_ABAP_CHAR_UTILITIES=>NEWLINE</b> in wa_itab-tdline with space.
if sy-subrc = 0.
conditions
endif.
endloop.
regards
vijay
06-20-2006 8:56 AM
Hi,
Please look at the code below. Had the same problem before.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_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.
Regards!
06-20-2006 7:10 AM
Hi suresh,
1. Since its an XML file,
<b> upload it as a text file (ASC)
(and not binary)</b>
regards,
amit m.
06-20-2006 7:42 AM
hi,
Check what value is passed to 'HAS_FIELD_SEPARATOR' change it to ''.
Also check up changing 'REPLACEMENT' to ''
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename =
FILETYPE = 'ASC'
<b> HAS_FIELD_SEPARATOR = ''</b>
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
<u> REPLACEMENT = '#'</u>
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
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
.
Sameena
Message was edited by: sameena attarwala
06-20-2006 10:43 AM
Hi Suresh,
You seem to be updating some long text using your internal table.
So it would be advisable not to use the 'has field separator' parameter as this would split up your long text at the first tab and the contents before the first tab will only come into the internal table.
The best solution would be call the function module below
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
filetype = 'ASC'
TABLES
data_tab = it_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.
Then loop at itab into wa_itab.
replace all occurences of CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB in wa_itab-tdline with space.
replace all occurences of CL_ABAP_CHAR_UTILITIES->New_line in wa_itab-tdline with space.
endloop.
Hope this helps.
Do award points for helpful answers