Application Development and Automation 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: 
Read only

Problem while downloading to Excel

Former Member
0 Likes
4,028

Hi All,

I am downloading my report output to Excel using button available in the screen in the back ground mode . In the output, I have a column field Material which includes values like

0100E0027

0100E0029

0100E0044

0100E0054

0100E0056

0100E0057

0100E0059

0100E0072

0100E0072

0100E0073

0100E0074

these are downloaded as below

1.00E+29

1.00E+31

1.00E+46

1.00E+56

1.00E+58

1.00E+59

1.00E+61

1.00E+74

1.00E+74

1.00E+75

1.00E+76

and I am not able to format it in the excel sheet.

But this not the case with other materials like

0008A0018

0008A0019

0008A0035

0008A0094

0008A0095

0008A0095

0008A0097

0008A0097

Please help with some solutions.

Regards,

Nibha

1 ACCEPTED SOLUTION
Read only

awin_prabhu
Active Contributor
0 Likes
2,905

Hi friend,

Remove the line

write_field_separator = 'X' in GUI_DOWNLOAD

This will give accurate values in excel.

Thanks..

Hi All,

I am downloading my report output to Excel using button available in the screen in the back ground mode . In the output, I have a column field Material which includes values like

0100E0027

0100E0029

0100E0044

0100E0054

0100E0056

0100E0057

0100E0059

0100E0072

0100E0072

0100E0073

0100E0074

these are downloaded as below

1.00E+29

1.00E+31

1.00E+46

1.00E+56

1.00E+58

1.00E+59

1.00E+61

1.00E+74

1.00E+74

1.00E+75

1.00E+76

and I am not able to format it in the excel sheet.

But this not the case with other materials like

0008A0018

0008A0019

0008A0035

0008A0094

0008A0095

0008A0095

0008A0097

0008A0097

Please help with some solutions.

Regards,

Nibha

11 REPLIES 11
Read only

former_member386202
Active Contributor
0 Likes
2,905

Hi,

Just double click on header right side of that column in excel sheet. (Extend the coulmn size)

Regards,

prashant

Read only

Former Member
0 Likes
2,905

hi,

it is downloading the value in exponent values u cancheck

IF value CS 'E+0' OR

v_value CS 'E-0' .

then if u dont want that then convert it to char using fm C14W_NUMBER_CHAR_CONVERSION

CALL FUNCTION 'C14W_NUMBER_CHAR_CONVERSION'

EXPORTING

i_float = w_float "exponent values

IMPORTING

e_dec = w_value_char "char values

EXCEPTIONS

number_too_big = 1

OTHERS = 2.

IF sy-subrc <> 0.

ELSE.

v_value = w_value_char.

ENDIF.

ENDIF.

thanks

Read only

former_member632729
Contributor
0 Likes
2,905

Hi ,

Are you using ALV method to output the list.. then check with Fieldcatlog..

Read only

awin_prabhu
Active Contributor
0 Likes
2,906

Hi friend,

Remove the line

write_field_separator = 'X' in GUI_DOWNLOAD

This will give accurate values in excel.

Thanks..

Read only

0 Likes
2,905

I am repeating my question again. I guess you all misunderstood.

My report is run in back ground. I am not using any down load function module in the code. I am downloading the alv display using SAVE TO LOCAL FILE... as spreadsheet.

Material No - 0100E0029 in the ALV Display is downloaded as 1.00E+29 in the Excel.

I have tried formatting it by defining it as number and changing the decimal places to 0.

But it is of no use because it is giving the material no as 100000000000000000000000000000

which is wrong value.

Please provide some suggestions.

Regards,

Nibha

Read only

0 Likes
2,905

Hi,

Please Test the following Sample Code hope will help you.

DATA: it_mara LIKE STANDARD TABLE OF mara WITH HEADER LINE.

SELECT matnr FROM mara UP TO 10 ROWS
  INTO CORRESPONDING FIELDS OF TABLE it_mara.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                    =
    filename                        = 'c:\aaa.xls'
*   FILETYPE                        = 'ASC'
*   APPEND                          = ' '
   WRITE_FIELD_SEPARATOR           = 'X'
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
*   WRITE_EOL                       = ABAP_TRUE
* IMPORTING
*   FILELENGTH                      =
  tables
    data_tab                        = it_mara[]
*   FIELDNAMES                      =
* EXCEPTIONS
*   FILE_WRITE_ERROR                = 1
*   NO_BATCH                        = 2
*   GUI_REFUSE_FILETRANSFER         = 3
*   INVALID_TYPE                    = 4
*   NO_AUTHORITY                    = 5
*   UNKNOWN_ERROR                   = 6
*   HEADER_NOT_ALLOWED              = 7
*   SEPARATOR_NOT_ALLOWED           = 8
*   FILESIZE_NOT_ALLOWED            = 9
*   HEADER_TOO_LONG                 = 10
*   DP_ERROR_CREATE                 = 11
*   DP_ERROR_SEND                   = 12
*   DP_ERROR_WRITE                  = 13
*   UNKNOWN_DP_ERROR                = 14
*   ACCESS_DENIED                   = 15
*   DP_OUT_OF_MEMORY                = 16
*   DISK_FULL                       = 17
*   DP_TIMEOUT                      = 18
*   FILE_NOT_FOUND                  = 19
*   DATAPROVIDER_EXCEPTION          = 20
*   CONTROL_FLUSH_ERROR             = 21
*   OTHERS                          = 22
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

above will save the File aaa.xls on Local Drive C:

Please Reply if any Issue.

Kind Regards,

Faisal

Read only

0 Likes
2,905

Hi,

In excel, select all cells that are with exponentials and

right click -> format cells -> In Number Tab -> fraction ->OK.

This will change your values.

Thanks...

Edited by: Sap Fan on Feb 18, 2009 11:46 AM

Edited by: Sap Fan on Feb 18, 2009 11:47 AM

Read only

0 Likes
2,905

Hi,

In your internal table, declare the material number as char19 and concatenate single quote and material number before downloading to excel sheet.

Regards.

Read only

0 Likes
2,905

Hi Ilesh

When i tried as below

CONSTANTS gc_qu VALUE `'`.

CONCATENATE gc_qu gs_lips-matnr INTO gs_data-matnr.
CONCATENATE gc_qu gs_lips-kdmat INTO gs_data-cmatnr.

the special character also displaying in excel

But when i change the same field manually with `'` displaying correctly

Internal table data as below

Kindly help on this.

Thanks.

Read only

Former Member
0 Likes
2,905

Hi,

It seems that it is not an SAP issue,

Check with the Excel you are using.

Regards,

Phani.

Read only

Former Member
0 Likes
2,905

This is a problem with the MS-Excel settings. Try passing the value as text.

Still if it doesnt work manually change the column settings in excel to text:

Select the column to which it will be populated. Right Click > Format cells > Number > Text.

Then download to this file....

Hope it will work...