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: 

preceeding zeros disapprearing in the excel download.

Former Member
0 Kudos

I have programmed ALV report using function module REUSE_ALV_GRID_DISPLAY.

I have declared my final output internal table's batch field as CHARG_D which is of 10 characters.

I have passed field_catelog-no_zero = 'X'. for batch field.

However when I download into excel sheet, preceeding zeros of batch disappearing in excel sheet.

Is there any way to retain the preceeding zeros for batch values and other similar fields values in the excel sheet after download ?

THANKS IN ADVANCE.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

There's a few variations on how to get the data from ALV into Excel and I don't have a system right now, so I can only give a general comment. If the direct export to Excel (OLE) doesn't work, I'd recommend to export the data as local file using format Spreadsheet and give it an extension like ".csv".

When saving the file this way, it really is just a tab separated file (text file, you can view it via Notepad and check for the leading zeros), which you can open in Excel. However, you have to be careful, because when you double-click on the file, Excel will usually open the file directly and format your batch (CHARG_D) field with type General. As a result anything that looks like a number, will be stripped off the leading zeros. Therefore instead you should open the data via the import wizard (e.g. in Excel 2007 it's on the Data ribbon under Get external data and then choosing From text) and reformat the field CHARG_D from General to Text. This will ensure that you'll keep the leading zeros.

There's lots of other ways to do it and my version is probably not the most efficient. However, it works in general, as long as you see the leading zeros in the ALV and is easy to remember (at least for me)...

Good luck, harald

3 REPLIES 3

Former Member
0 Kudos

There's a few variations on how to get the data from ALV into Excel and I don't have a system right now, so I can only give a general comment. If the direct export to Excel (OLE) doesn't work, I'd recommend to export the data as local file using format Spreadsheet and give it an extension like ".csv".

When saving the file this way, it really is just a tab separated file (text file, you can view it via Notepad and check for the leading zeros), which you can open in Excel. However, you have to be careful, because when you double-click on the file, Excel will usually open the file directly and format your batch (CHARG_D) field with type General. As a result anything that looks like a number, will be stripped off the leading zeros. Therefore instead you should open the data via the import wizard (e.g. in Excel 2007 it's on the Data ribbon under Get external data and then choosing From text) and reformat the field CHARG_D from General to Text. This will ensure that you'll keep the leading zeros.

There's lots of other ways to do it and my version is probably not the most efficient. However, it works in general, as long as you see the leading zeros in the ALV and is easy to remember (at least for me)...

Good luck, harald

Former Member
0 Kudos

Hi Sam,

Whenver u will download in Excel Format Zeros will be suppressed bcz it does not support data with Zero Format.

e.g. Barcode : 02000193 in Excel it will come as 2000193

but Barcode : 02abcd wiill be 02abcd

So, u just make ur owm PF Status and then Call the Standard FM 'Excel_download' or any and then pass the import Paramaerts Format as 'DAT' not Ascii or Binary.

Regards

Arbind

Sandra_Rossi
Active Contributor
0 Kudos

Which SAP release and support package do you use?

Did you check these notes:

Note 402155 - Known problems during Excel export as of Release 4.6C

Note 394675 - Zeros deleted during Excel export

Could you check [these threads (keywords: alv excel zero)|http://www.sdn.sap.com/irj/scn/advancedsearch?query=alvexcelzero] too.