2013 Jan 30 2:54 PM
Hello ZIP, Excel and ABAP2XLSX-Experts,
I'd like to convert a given Excel-File (.xls) which has been uploaded to the DMS in SAP-DB-Tables (like DRAW etc.) via transaction CV01n to an excel_reader_2007 object.
After that I'll hopefully be able to address the excel-object and insert my report-data into the right cells given by that template.
I've managed it to that point, where I've already read the content of the file (type: xstring) in my excel class with this method:
...
me->mv_content = me->raw_to_xstring( input = lt_orblk ).
...
After that I try to instanciate an excel_reader_2007-class:
...
CREATE OBJECT lo_excel_reader TYPE zcl_excel_reader_2007.
co_excel = lo_excel_reader->zif_excel_reader~load(
me->mv_template_xstring ).
....
In this load-interfacemethod the ixml is beeing drawn from a zip-archive - whatever it's doing here with the rels thing:
...
me->excel2007 = i_excel2007.
rels = me->get_ixml_from_zip_archive( '_rels/.rels' ).
....
This method calls immediately the next method: get_from_zip_archive.
...
content = me->get_from_zip_archive( i_filename ). "_rels/.rels
And then, in this method a zip-object is created and loaded.
...
CREATE OBJECT me->zip. "CL_ABAP_ZIP
zip->load(
EXPORTING
zip = me->excel2007
...
I think this load-method is already the troublemaker:
In the line 75 nothing is done, because the offset is 0, maxlength = 3601404 and zip+offset(4) = 'D0CF11E0' and never '504B0304'
...
WHILE offset < max_length AND zip+offset(4) = '504B0304'. " local file header signature
file_no = file_no + 1.
APPEND INITIAL LINE TO files ASSIGNING <file>.
APPEND INITIAL LINE TO exts ASSIGNING <ext>.
...
But the zip->load( me->excel2007 ) runs without exception but the table 'Files' will not be filled. That's the crux because in the next ZIP-method in method get_from_zip_archive will be tried to read the zip-files:
...
zip->get(
EXPORTING
name = i_filename
IMPORTING
content = r_content " Contents
....
And here, the read from table files fails of course with the raise of zip_index_error.
IF index IS INITIAL.
READ TABLE files TRANSPORTING NO FIELDS WITH KEY name = name.
IF sy-subrc IS NOT INITIAL.
RAISE zip_index_error. "#EC RAISE_OK
ENDIF.
index = sy-tabix.
ENDIF.
Now, can anybody tell me, how I get my xstring - content successfully transferred to ZIP or that ZCL_EXCEL_READER_2007 class.
What went wrong?
Is it possible that it has got to do with the installation of the frontend or that the xls is maybe 2002 Version?`
It doesn't help to save it as .xml. I already tried it.
I would appreciate some help!
________________________________________________________________________________________________________________
Version of the System is ECC 6.0, SAP-Basis 7.31, ABAP2XLSX-Version 5.0 (doesn't work with the change to 7.0, too - already tried it)
2013 Feb 12 5:25 PM
Solved: The Version of the .xls-template in the DMS (document management system) was Excel 2002.
I uploaded a Excel 2010 version in the DMS and then it worked.
Having a 2002 Excel version always creates a local header with the zip+offset(4) =
'D0CF11E0' .
Solved: The Version of the .xls-template in the DMS (document management system) was Excel 2002.
I uploaded a Excel 2010 version in the DMS and then it worked.
Having a 2002 Excel version always creates a local header with the zip+offset(4) =
'D0CF11E0' .
2013 Feb 12 5:25 PM
Solved: The Version of the .xls-template in the DMS (document management system) was Excel 2002.
I uploaded a Excel 2010 version in the DMS and then it worked.
Having a 2002 Excel version always creates a local header with the zip+offset(4) =
'D0CF11E0' .
2019 Oct 10 7:52 AM
Hi,
I have the same requirement to read a XLS template from DMS and then fill the data into the correct cells from other XLS files and SAP table.
I am not even sure on how to start. Could you please share the solution you implemented ?
2019 Dec 13 12:33 AM
I am facing similar issue. Do you have steps to load Excel 2010 version to DMS? Thanks.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |