Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Excel export dropping minus sign

Former Member
0 Kudos

Hi All,

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?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Gregor,

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.

Best Regards,

Jamie

2 REPLIES 2

Former Member
0 Kudos

Gregor,

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.

Best Regards,

Jamie

Former Member
0 Kudos

Hi,

Replace the data type with MENGV,

It will help you to export the quantity with sign.

Regards

Elini.P