2015 Jun 18 9:15 AM
Hello Community,
yes, this has been asked so many times before. I've read so many threads, but they all point to the same improper function modules.
I need a function (function module, method) that supports the same path length 1024 as method FILE_OPEN_DIALOG of class CL_GUI_FRONTEND_SERVICES, that also supports full cell value length and delivers all used rows and columns.
List of the improper function modules:
KCD_EXCEL_OLE_TO_INT_CONVERT
ALSM_EXCEL_TO_INTERNAL_TABLE
TEXT_CONVERT_XLS_TO_SAP
Main issues:
Path length 128 is much too short.
EXCEL supports cell values up to 32767 characters.
What I need is full EXCEL support for path length 1024 characters and cell value support for 32767 characters.
Dow you know any SAP standard tools that could help me? Method GUI_UPLOAD works fine to upload the file, but I don't know how to extract the data from it.
Regards,
Klaus
2015 Jun 18 9:23 AM
Hi Klaus,
Using only standard tools is mandatory?
In this case, you have to replicate what ABAP2XLSX's reader class do.
i crashed on the same issue many times but finally my customer accepted to install ABAP2XLSX and now they cannot live without all the available features they got
ABAP2XLSX "just" organize the procedure to manage XLSX file with standard tools.
You can do the same but replicate it sounds a bit "silly" like re-inventing the wheel.
2015 Jun 18 9:23 AM
Hi Klaus,
Using only standard tools is mandatory?
In this case, you have to replicate what ABAP2XLSX's reader class do.
i crashed on the same issue many times but finally my customer accepted to install ABAP2XLSX and now they cannot live without all the available features they got
ABAP2XLSX "just" organize the procedure to manage XLSX file with standard tools.
You can do the same but replicate it sounds a bit "silly" like re-inventing the wheel.
2015 Jun 18 9:52 AM
Hi Simone,
many thanks for your answer. I've also found this blog about XLSX2ABAP, which looks very interesting. But I'm not allowed to install foreign software addons for CERT and security reasons.
I fear the worst, that there will be no SAP standard solution for this issue available.
Best regards,
Klaus
2015 Jun 18 10:11 AM
2015 Jun 18 2:27 PM
Unfortunately no standard solution
I'm trying to have abap2xlsx included in the SAP standard, but without any success so far. Your voice can help to support the cause!
I had many discussion with several consultants and customers on this topic, and you should check this thread [abap2xlsx] How to argue for Security in abap2xlsx
Ivan
2015 Jun 19 6:23 AM
Hi Ivan,
I have no authorization for that thread.
Regards,
Klaus
2015 Jun 19 2:38 PM
I managed to get it installed in a CSV GxP relevant system. I just had a chat with the development manager. Even the naming convention being at variance with the defined standard wasn't an issue. Maybe it's just my winning personality... but I suspect it was the fact it was a business requirement.
2015 Jun 19 2:42 PM
I can't see it either, so I've raised it in the moderator space.
2015 Jun 22 7:42 AM
"The whole Code Exchange was shut down. In order to retrieve content from there you need to reach out to devcenter@sap.com ( I can introduce you). To where should we migrate the content?"
2015 Jun 22 10:38 AM
2015 Jun 18 6:32 PM
Check if your system has CL_FDT_XL_SPREADSHEET class. This is related to FDT (Formula and Derivation Tool) and not intended to read generic spreadsheet, but it works in most cases.
If it exists,
Use IF_FDT_DOC_SPREADSHEET~GET_WORKSHEET_NAMES method, to get the worksheet names from the excel spreadsheet.
For each of the worksheet names, use IF_FDT_DOC_SPREADSHEET~GET_ITAB_FROM_WORKSHEET method to get the contents of the worksheet into internal table.
Thanks,
Juwin
2015 Jun 19 6:21 AM
Hi Juwin,
many thanks for your reply, but this class is not available in our systems.
Regards,
Klaus
2015 Jun 19 1:57 PM
Ok, even without this class, reading an XLSX file is easy. All you have to know is how to parse XML files.
Thanks,
Juwin
2021 Dec 17 4:52 PM
There is just one huge mis-approach in the SAP code:
Internally, SAPs CL_FDT_XL_SPREADSHEET->GET_ITAB_FROM_SHEET uses
METHOD cl_alv_table_create=>create_dynamic_table
This method, instead of simply using RTTS dynamic type services, creates a fieldcatalog and generates the tables in a dymaic subroutine pool one by one. Thus, there is as (SAP-typical) limit of 36 tables. If the excel sheet hast more than 36 tabs, you get a dump with a completely misleading error message.
I could not try abap2xlsx because I still can't work with the abapgit standalone program (that's another theme). But I'm afraid it won't help because it uses the same SAP standard methods.
Is there any SAP standard alternative that does not use this f... cl_alv_table_create=>create_dynamic_table?
Thank you all.
Regards Clemens
2015 Jun 19 6:33 AM
Hi,
meanwhile I've made a copy of fm ALSM_EXCEL_TO_INTERNAL_TABLE and changed the interface and some internal tables.
Changes made:
It's working fine for me, also cells containing long text can be read, but I don't think that the max cell content of 32767 characters will work now. There might be still some limitations remaining.
Thank you all for your good ideas.
Regards,
Klaus
2015 Jun 19 2:43 PM
Re: external not allowed for security reasons. Copying a standard FM is, in my opinion far more risky and expensive. Cloning is last possible option and should only be done as a last last last resort.
2015 Jun 19 3:02 PM
Well, I agree. But SAP note 933420 recommends to do so (copy module to customer name space).
Anyway, this FM is not released 🙂
It would be nice to have better cooperation SAP vs. Microsoft overall.
2015 Jun 22 5:48 AM
Hi Matthew,
for myself I agree with you. But the copy into our custom namespace makes it a custom program code (no addon or foreign code) and will be also scanned by our security tools. In addition to SAP CERT notes we have a custom tool in our company to scan all code other than SAP code. This is weekly done by our CIT for all our production systems all over the world by remote access.
We have several classes of code that may contain security lacks:
So it's more easier to use custom code than addon code.
Regards,
Klaus