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: 

TEXT_CONVERT_XLS_TO_SAP error

raffinkira
Participant
12,046

Hi all,

I am using  TEXT_CONVERT_XLS_TO_SAP to upload excel and convert the data into an internal table.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

     EXPORTING

*     I_FIELD_SEPERATOR =

*      i_line_header = 'X'

       i_tab_raw_data = gt_raw

       i_filename = p_file

     TABLES

       i_tab_converted_data = gt_del

     EXCEPTIONS

       conversion_failed = 1

     OTHERS = 2

However,  and sy-subrc is always 1.

I have digged out of an error which is DOCUMENT_TYPE_NOT_REGISTERED inside the FM.

I have gone through many samples and I think the code is OK.

Can anyone help me out?

12 REPLIES 12

raffinkira
Participant
0 Kudos
6,766

The excel has 9 cols and so does the internal table.

I also have tried the both cases in having header or not.

SimoneMilesi
Active Contributor
0 Kudos
6,766

Hi Ming Yu,

two questions:

1-your system release,

2-the kind of file you are trying to upload. (XLS? XLSX?)

This because some releases don't manage well XLSX files with this FM.

Another thing: check you have excel closed when you run the FM (check even Task Manager where sometimes excel's processes runs even when you close it).

0 Kudos
6,766

It's 740 final and the excel is XLSX.

I let another guy to try my code and it worked on his computer.

So I think it has something to do with the environment.

0 Kudos
6,766

Did you check the task manager as i suggested? The file was the same?

0 Kudos
6,766

0 Kudos
6,766

I have checked the task manager.

BTW, I recall that my office is some sort of read-only version.

So is it the reason that SAP cannot get data from excel?

0 Kudos
6,766

Urgh.. never met this kind of combo so i avoid giving you wrong infos.

Sorry i was not so useful 😐

0 Kudos
6,766

Not really, your info is helpful and thank you for the help:)

Former Member
0 Kudos
6,766

Hello Ming,

Trying using this fm ALSM_EXCEL_TO_INTERNAL_TABLE to upload the data into internal table.

deepak_sharma_sap
Active Participant
6,766

Hi Ming,

I checked the FM TEXT_CONVER_XLS_TO_SAP and it worked fine for me. Hope you internal table contains only the char fields.

Alternate you can use any of the below :

1. You can use the FM : ALSM_EXCEL_TO_INTERNAL_TABLE

2. You can use the OO concept. Check the lonk below

https://wiki.scn.sap.com/wiki/display/Snippets/ABAP+-+Upload+data+from+Excel+to+Sap+using+OO?origina...


Thanks

Deepak Sharma

0 Kudos
6,766

Char field fix worked for me. Thanks for the tip 🙂

0 Kudos
6,766

Dear Ming,

Please check your input .XLSX file, if file contains any date/time column then check it's format.

If your system's date/time format is not matching with your SAP system's date/time format then this FM will cause an error i.e sy-subrc = 1.

E.g

Date format in your system = 01-21-2021 and Date format in SAP system = 01/21/2021. Here separators are different. And your excel file pick your system's date/time format.

So to use this FM 'TEXT_CONVERT_XLS_TO_SAP' if your file having date/time columns then your system's date/time format and SAP system's date/time format must be identical.

Thanks & Regards,

Rahul B