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: 

How to download a char(12) field into an excel file.

Former Member
0 Kudos
486

Hi all,

I have an internal table with a field defined as char 12. I pass this internal table to FM MS_EXCEL_OLE_STAN DARD_DAT but I find in my excel file this value: 9,87654E+11.

Any idea to obtain the correct value 987654321011?

Thanks in advance for your kind support.

Regards,

Luigi

9 REPLIES 9

Former Member
0 Kudos
243

Hi,

In excel file, format the cell category as 'NUMBER'.

right click on the cell in excel file and click on format cell, select the category as 'NUMBER', Value will come appropriately.

Thanks

Hemant

vinod_vemuru2
Active Contributor
0 Kudos
243

Hi,

Just try to expand that cell width. It will display complete value. It is the standard excel property.

Thanks,

Vinod.

Former Member
0 Kudos
243

Hi,

this is my test.

FM SAP_CONVERT_TO_XLS_FORMAT and FM MS_EXCEL_OLE_STANDARD_DAT: the value in excel file is 9,87654E+11 launching both functions. If I try to resize the column, this value don't change. If I set as cell type (manually) number with zero decimals, this is ok.

For may test I userd the field knvv-eikto.

How it is possible to have this value downloaded correctly into the excel file?

Thanks in advance for your kind support.

Regards,

Luigi

0 Kudos
243

Hi,

If the excel file which you are downloading is only for display purpose, you can include an apostrophe ( ' ) prior to char12..

The output then looks as you expected.

'987654321012

Regards,

Sailaja.

0 Kudos
243

With a leading apostrophe its no longer a number.

There is no way to control excel how it displays numbers, excel is even taking the screen width in consideration (more or less/broader/smaller columns) when choosing the cell format.

Former Member
0 Kudos
243

Ok I tried using the FM 'GUI_DOWNLOAD' but I obtained the same issue.

Using OLE objects (TYPE-POOLS ole2) I find many possibilities to "create" a workbook" in the same way I can use excel macro.

Do you have any suggestion or abap code?

Thanks.

Luigi

0 Kudos
243

In the above FM there is parameter called 'FILE TYPE'

pass the value for it as 'DBF'

it will work.

0 Kudos
243

Luigi, in this thread , I explained how to record a macro in Excel in VBA, and convert it (manually of course ) into ABAP OLE statements. You will easily get the code to set the cell number format.

Note that SAP created a layer called Desktop Office Integration (DOI), based on OLE. It may ease some operations. There are some demo programs in SAP (search DEMOINTEGR* or DEMODOI*).

Former Member
0 Kudos
243

Expand the cell of excel file.