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: 

Need leading Zeros in the excel sheet which is sent from ABAP

Former Member
0 Kudos

Hi ,

I am downloading data from SAP to excel sheet using the WS_DOWNLOAD Function Module. The numeric data in not having leading zeros. if it is 0010 it is displaying 10 in the excel sheet . i need the leading zeros in the excel sheet. without manulally changing it to Text in the excel sheet .

Is there any way to do it .

Thanks,

Chetan

8 REPLIES 8

Former Member
0 Kudos

Declare the field as Text and save the value into it with leading zeroes.

Former Member
0 Kudos

i think that's an excel configuration, try sending the numbers in " "

regards, sebastian

Former Member
0 Kudos

Hi Chetan,


  CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      filename                = w_file_path
      filetype                = 'DBF'                       "declare the File type as DBF then leading zeros will appear
      write_field_separator   = 'X'
      confirm_overwrite       = 'X'
    TABLES
      data_tab                = Itab.

Regards,

Prabhudas

GauthamV
Active Contributor
0 Kudos

Use GUI_DOWNLOAD function module as WS_DOWNLOAD is obselete.

And give file type as 'DBF' in that fm which should give leading zeros in excel.

Former Member
0 Kudos

Chetan,

check this link

http://help-abap.blogspot.com/search/label/Excel%20Formatting

Thanks

Bala Duvvuri

0 Kudos

A better solution is now here with the abap2xlsx Project: http://code.google.com/p/abap2xlsx/

mrio_espinheira
Participant
0 Kudos

Hello,

As Swastik Bharati mentioned, you should declare the field as char and save the value (with leading zeros) and an apostrophe preceding it (e.g. '0010), just like you can do in Excel.

Best regards.

kesavadas_thekkillath
Active Contributor
0 Kudos

This can be done by concatenating a single quotation to the field before downloading . I have done this before and worked fine.

You can refer this blog by Naimesh link:[http://help-abap.blogspot.com/2008/09/preserve-downloaded-data-formatting-in.html] for more details.