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

ALV export to excel problem

Former Member
0 Likes
860

Hi Gurus,

I facing a problem with ALV. When an ALV report is exported to Spreadsheet file (Exce file) two columns are giving follwing proble.

1. First column doesnot display left side zeros of dcoument no when exprted to excel. for example- 0000245487 to 245487.

2 in Another column right two digit are trucated when exported to excel. for examples 0000245487 to 2454.

What may be the prblem.

\[removed by moderator\]

Regards

Rajesh

Edited by: Jan Stallkamp on Jul 21, 2008 2:35 PM

6 REPLIES 6
Read only

Former Member
0 Likes
684

first problem is because MS EXCEL doesnot allow u to have leading zeros.

try typing 000123456 and press enter.. the leading zeros will vanish.

second prob mite be because the col width in excel is not sufficient enuf. i guess so.

pk

Read only

Former Member
0 Likes
684

I too faced this problem. It is problem with excel.

This method by putting filetype as DBF in FM GUI_DOWNLOAD will defnetly help you, but this is obselete form of writing.

ofname is the file destinataion.

it_data is the internal table.

Syntax.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = ofname

filetype = 'DBF'

write_field_separator = 'X'

TABLES

data_tab = it_data.

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.

\[removed by moderator\]

Thanks,

Imran.

Edited by: Jan Stallkamp on Jul 21, 2008 2:35 PM

Read only

0 Likes
684

Hye rajesh,

Did that work..mate.

Read only

Former Member
0 Likes
684

HEY have you passed NO_ZERO parameters when define fieldcatlog

Read only

giancarla_aguilar
Participant
0 Likes
684

Hello.

Look into SAP Note 213427. It corrects this problem.

😃

Read only

Former Member
0 Likes
684

Hi Rajesh,

May be the following FM will be useful, to download the data from ALV to Excel in the same format as ALV.

1. GUI_Download:

In this FM in the parameter Filetype give the value as DBF i.e.

Filetype = DBF.

THe data gets downloaded perfectly.

2. SAP_CONVERT_TO_XLS_FORMAT

This FM also downloads the data to excel in the same format as ALV.

\[removed by moderator\]

Thanks,

Edited by: Jan Stallkamp on Jul 21, 2008 2:35 PM