ALV Excel export dropping minus sign
I have an OO ALV grid which is displaying fine. Some fields (of type mseg-menge) are negative but when I export to Excel the minus sign is getting dropped.
Any ideas? Is it down to the data type?
Domain MENG13 (for mseg-menge) does not allow a sign (i.e. it is defined in the dictionary with the sign flag unchecked). As stated in the F1 help for the domain checkbox for "Sign", "If the flag is not set but the field contains negative values, problems might occur during screen output."
Maybe the sign flag on the domain is being checked by the Excel download logic causing the sign to be dropped, or it could just be the version of Excel that you are using is not "smart" enough to convert your negative quantities into negative Excel values.
When you say "OO ALV grid" do you mean you are using CL_GUI_ALV_GRID or are you using the ALV Object Model CL_SALV_TABLE? I will assume you meant CL_GUI_ALV_GRID.
I simulated your scenario using CL_GUI_ALV_GRID in ECC 5.0 by forcing an ALV field of type MENGE_D (same as mseg-menge) to have a negative value it_alv-menge = '1.000-'. The ALV output showed the negative sign like this "1.000-" and the Excel 2003 output also contained a negative value. This tells us that for CL_GUI_ALV_GRID in ECC 5.0 and Excel 2003 the problem does not exist.
I didn't find any SAP Notes that exactly match your scenario, but you can take a look at [Note 939815 - Spreadsheet download of fields with minus sign|https://service.sap.com/sap/support/notes/939815]. It could be that you have discovered a problem that needs to be submitted as a customer message to SAP. Or it could just be that the problem was fixed in a SAP patch or note that I didn't find. Or as I suggested above, it could be an Excel issue.
I hope some of this analysis will help you out.