Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error in Reading data from Excel

Former Member
0 Likes
1,376

Hi Guys,

I am using the FM "TEXT_CONVERT_XLS_TO_SAP" for reading data from Excel files. It work absolutely fine for first two files. But for the third one, it just gets stuck & then gives a short dump ( Exception: DP_ERROR_GET_DATA).

Has anybody have had similar experiences?

Regards,

Munish

1 ACCEPTED SOLUTION
Read only

former_member189059
Active Contributor
0 Likes
950

1. is it a problem with the THIRD file no matter which sequence you enter the files

2. or is it a problem with a particular file

if it is the second case, then check for any peculiarities in the file itself - maybe it contains some illegal data / characters / formatting

3 REPLIES 3
Read only

Former Member
0 Likes
950

Hi,

you can try the folowing sample..

and make modifications according to your requirement..

TYPE-POOLS: truxs.
 
DATA: i_text_data TYPE truxs_t_text_data,
v_filename_string TYPE string.
 
DATA: BEGIN OF itab OCCURS 0,
Name(30),
Phone(15),
Fax(500).
DATA: END OF itab.
 
PARAMETERS: p_file LIKE rlgrap-filename.
 
START-OF-SELECTION.
 
v_filename_string = p_file.
 
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.
 
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
* I_LINE_HEADER =
i_tab_raw_data = i_text_data
i_filename = p_file
TABLES
i_tab_converted_data = itab
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

this is a sample code that uploads a excel file using GUI_UPLOAD, but uses another function module to convert that uploaded data into an internal table..

Regards

Sudheer

Read only

former_member189059
Active Contributor
0 Likes
951

1. is it a problem with the THIRD file no matter which sequence you enter the files

2. or is it a problem with a particular file

if it is the second case, then check for any peculiarities in the file itself - maybe it contains some illegal data / characters / formatting

Read only

0 Likes
950

Yes the problem was with file. Eventually I had created the whole template once again.

Thanks...