‎2011 Jul 11 11:30 PM
Hi,
I am using a program to upload a excel file and read the contents. One of the field in the excel has value ABC - XYZ, but, this field is read as ABC # XYZ in the program. I tried to use replace and all the class/methods of abap_char_util but its still not working.
In hex, the value of # is 23 right? But when executing the program, the value of ABC # XYZ has 96 for field # under hexadecimal value.
So what is this 96 hex value? Or how do we search or replace this # value? Pls help.
Thanks
Subha
‎2011 Jul 12 4:18 AM
Try to implement following logic.
data: gt_data type table of string.
data: ls_data type string.
data: lt_data type table of string.
Load the GT_DATA using GUI_UPLOAD from Excel.
call function 'GUI_UPLOAD'
exporting
filename = lv_temp_file
has_field_separator = ' '
tables
data_tab = gt_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.
gv_error = abap_true.
endif.
loop at gt_data into ls_data.
split ls_data at cl_abap_char_utilities=>horizontal_tab into table lt_data.
endloop.
by above code you will have each value with one record line in LT_DATA.
‎2011 Jul 12 2:19 PM
I have resolved it myself. I converted the hex value 96 to string using method cl_abap_conv_in_ce->convert. Then used REPLACE the string(#) with - . This worked.
Thanks