E 20241128 Excel Issue
E 20241128 Excel Issue
Symptom
The 'Export to excel' function of an ALV grid creates a corrupt xlsx file, which cannot be opened by Microsoft Excel. The
error message is similar to the following example:
"Removed Part: /xl/sharedStrings.xml part with XML error. (Strings) Illegal xml character. Line 1, column 393939.
Removed Records: Cell information from /xl/worksheets/sheet1.xml part"
Which may be accompanied of other error pop ups such as "We found a problem with some content in '<filename>.XLS'. Do
you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is
purely coincidental.
Environment
SAP NetWeaver
SAP Web Application Server for SAP S/4HANA all versions
Web Dynpro for ABAP
Cause
The 'Illegal xml character...' message is not ABAP related, but a known limitation in XML. In such cases, the data to be
exported contains characters which are unknown or illegal in XML.
Resolution
How to determine the illegal XML character
1. After exported the .XLSX file, change the file extension to .ZIP, then decompress it.
2. Find the sharedStrings.xml file within the 'xl' folder. It could also be the file /xl/worksheets/sheet1.xml.
3. Open it, with an editor, which can show the position of the characters.
4. Check the line and column showed in the error message. The shortcut 'Ctrl + G' can be used to find the column.
5. Take notes about these characters and rename the whole file back to .XLSX extension. (Do not change and save the xml
here because after the compression the XLSX file will be corrupt.)
How to fix the error
1. Change the extension from .XLSX to .ZIP (do not decompress it!).
2. Double click on the .ZIP file and find the sharedStrings.xml file.
3. Copy sharedStrings.xml to any location, but "out of" the .zip file (to desktop, for instance)
4. Open the copied sharedStrings.xml file with an xml editor and find the characters which were discovered in the first
part of the Resolution ("How to determine the illegal XML character").
5. Delete these corrupted characters and save the file.
6. Copy the sharedStrings.xml back to from where it was copied (it was in the .zip) - use copy & replace
when windows asks, so basically overwrite the corrupted sharedStrings.xml with the changed/corrected
sharedStrings.xml
7. After finishing, change the extension back to .XLSX.
NOTE: Copying the sharedString.xml file is necessary because the OS will not let the file get changed within the .zip, even if
the read-only flag is removed.
The corresponding application team is responsible for the data itself.
In case further assistance is needed, involve the appropriate component.
See Also
KBA 2517992 - Export to excel creates corrupt file
SAP Note 1825127 - ALV Grid: Display of strange characters
KBA 3413729 - Excel error "We found a problem with some content in '<filename>.xls'" occurs when saving ALV as
'EXCEL Files (*.xls) through Local file (Ctrl+Shift+ F9)
Keywords
export to excel, alv, corrupt, XML, illegal character, wrong character, misplaced character, popup, excel error, try to open, not
possible, not opening, warning, popup, removed part, /xl/sharedStrings.xml, exportieren, verdorben, falsch character,
dialogfenster, warnung, Excel was able to open the file by repairing or removing the unreadable content. , Repairs to
'export.XLSX', ALVGrid, Gridview, ALV grid view, ALVgridview, � Removed Part: /xl/sharedStrings.xml part with XML
error. (Strings) Illegal xml character; Removed Records: Cell information from /xl/worksheets/sheet1.xml part. Line 1,
corrupted, corruption, problem, recover.
Attributes
Key Value
Other Basis Components > Frontend Services (SAP Note 1322184) > SAP Desktop Office Integration (BC-FES-OFFI)
Components
Other Basis Components > Web Dynpro > Configurable Component > List Viewer > ALV for ABAP (BC-WD-CMP-ALV-
Components ABA)
Products
Products
2810959 Illegal xml character error occurs when exporting the report result into Excel - SAP ERP &
SAP S/4HANA.