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

getting excel error

Former Member
0 Likes
530

Hi friends,

I am using the following fuction module

FORM GET_MAT_FROM_SPREAD .

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

i_line_header = 'X'

i_tab_raw_data = it_raw " WORK TABLE

i_filename = p_FILE2

TABLES

i_tab_converted_data = i_spreadsheet[] . "ACTUAL DATA

  • EXCEPTIONS

  • conversion_failed = 1

  • OTHERS = 2.

IF SY-SUBRC = 0.

ENDIF.

ENDFORM. " GET_MAT_FROM_SPREAD

but iam getting the error

Excel file FILE://C:\Documents and Settings\my id\Desktop\C cannot be processed

what was problem plz let me know

3 REPLIES 3
Read only

Former Member
0 Likes
513

Hi Sukruthi,

There is a limit on Filename including path. It should be 128 characters.

Have a look at the attached code :

Define the tables according to your import data,

"or just define an structure,

"and then define the internal table

DATA IT_Map type table of ZYFIAccountMapCN.

TYPE-POOLS: truxs.

DATA F_Name(128) type C value 'd:\0927.xls'.

DATA: it_raw TYPE truxs_t_text_data.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

I_FIELD_SEPERATOR =

I_LINE_HEADER =

I_TAB_RAW_DATA = it_raw

I_FILENAME = F_Name

TABLES

I_TAB_CONVERTED_DATA = IT_Map

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.

Reward Points if it is useful.

Read only

Former Member
0 Likes
513

make use of "ALSM_EXCEL_TO_INTERNAL_TABLE" function module.

Read only

Former Member
0 Likes
513

hi,

1. Check whether the file path is correct.

2. while converting the file, make sure that the file shuld not opend or accessed by others

3. check the file content and internal table declaration whther both r matched or not.

thanks,

Arunprasad.P