Skip to Content
-1

How to read .XLS file from Application server in background

May 23, 2017 at 02:39 PM

451

avatar image

Hi,

I need to read .xls / .xlsx file from the application server in background. Tried to create using transformation as suggested in a few blogs but there is an exception caught at

lo_package = cl_xlsx_document=>load_document( iv_data = l_xstring ).

RAISE EXCEPTION TYPE cx_openxml_format.

The requirement is not to save the excel file as .csv file.

Any suggestions please.

Thanks

Aravind

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raymond Giuseppi
May 23, 2017 at 03:04 PM
1

AFAIK this method wont read XLS files (old Microsoft proprietary format) , only XLSX ones (actually zipped XML file)

2163344 - Availability and support of classes in package S_OOXML_CORE 'CL_XLSX_DOCUMENT to read data from Excel file with extension .xlsx'

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Yes, it supports xlsx but not xls

0
Roberto Vacca May 23, 2017 at 03:20 PM
1

Hi.

Read file XLS? My suggest is to implement a workaround.

1 - Launch your report in foreground;

2 - read XLS data with TEXT_CONVERT_XLS_TO_SAP for example;

3 - export binary data to shared buffer memory

4 - launch a job in background with JOB_OPEN function and SUBMIT your report with your "background" logic with an Import instruction of your binary tab from shared buffer memory (remember to DELETE FROM SHARED BUFFER indx(st) ID 'Zexamplename '. )

instead of these steps you can try with class i_oi_document_proxy and its methods.

Anyway, you can save your file in XLSX format and do as Raymond suggests that is better :D

Hope to help

Bye

Show 1 Share
10 |10000 characters needed characters left characters exceeded

The requirement is not to perform in Foreground.

The file will be in AL11. The read program will be executed in background. The file will be received in .xls or .xslx. Wish i could restrict the sender not to send in .xls but can't.

0
Sandra Rossi May 24, 2017 at 06:40 AM
0

Another solution could be to install a Windows PC with MS Office, as a server, and use it to convert the XLS file (create a VBS script to automate Excel, it should be a quite short script, start the SAP GUI program "rfcexec" so that to register this computer as an RFC server with a given "program ID"; create an RFC destination to this computer/program + the program ID, and you call function "RFC_REMOTE_EXEC" in this RFC destination, from the SAP system, and so on). I never did it myself, just thinking it might be feasible. No idea if you need a license for this special use.

Or a converter software probably exists (to buy).

Share
10 |10000 characters needed characters left characters exceeded