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: 

ALV Report Export to Excel

Former Member
0 Kudos

Hi experts,

I generated ALV report with proper data information but when I export it to excel with this path List->Export->Local File->Spreadsheet.

All the data I get perfectly expecting the Mobile no. filed. In my ALV report I got mobile no field with 91(Mob. No). wx.919876543210. But when I export it to excel then I got 919876543210, not able to get +.

So kindly suggest me if any option is there.!!!!

16 REPLIES 16

deepak_dhamat
Active Contributor
0 Kudos

hi,

SAve in unconverted format .

Search on sdn it is repeated plenty of times

regards

Deepak.

Edited by: Deepak Dhamat on Oct 19, 2011 7:47 AM

0 Kudos

If i choose the unconverted format then it is download to .txt file and want to download the data in excel file.

0 Kudos

Hi ,

Open Blank Excel nad import that txt file With Fixed format . you will get all data .

regards

Deepak.

Former Member
0 Kudos

I don't remember exactly but you can try this way...Search in SDN, you would get lots of threads on this.

In excel type

"+919888156677

and press enter. You will get the value as "+919888156677.

Take this value into a variable and remove the quote using offset and pass this to your excel download internal table.

Hope this works.

Thanks,

Arya

0 Kudos

Hi Arya,

I am not using excel download frm my code (GUI_DOWNLOAD) . I just generate the ALV report and then report page using list->export->local file. So in that there's no option to pass the value as internal table as you said.

0 Kudos

I don't think it's possible to generate the '+' sign infront of mobile number incase you are using export to local file. It's standard SAP ALV functionality.

All you can do is try some turn arounds in the code or use FM GUI_DOWNLOAD

Former Member
0 Kudos

Hi,

in Excel you can type an apostrophe (') before your number, then the number will be converted into a text and the plus sign (+) will be displayed.

For example type in a cell the following string:

'+919888156677

Kind regards,

Daniel

deepak_dhamat
Active Contributor
0 Kudos

Hi ,

When you are adding Mobile no in column , add in this way "+9823832662 .

Double quote before + sign . then you will get + sign in excel .

regards

Deepak.

Former Member
0 Kudos

hi Manan ,

instead of doing this ( List->Export->Local File->Spreadsheet)

follow this steps :-

List->Export->Spreadsheet-> Excel(in MHTML format) .

this will surely solve ur problm .

Regards

Ranjan Tiwari

Former Member
0 Kudos

Actually, this is not ALV problem but Excel problem. Even though you enter 12345 manually, excel will automatically convert it into 12345. Basically, all you can do is change the call format into text format or enter together with single quote, '12345.

0 Kudos

Daer All,

yes it is right that this is the problem of Microsoft Excel that we have to convert it as Text then we get it as +91...

But if I do that as you suggested '..then it diplay in ALV report '+919876543210... But the single quotes is also not required in report that the condition .

So it is better to display +91 9876543210. So separate the whole mobile number into two parts and then display . Then it would be get exactly in excel also. So i think it is the better way to display.

Thanks for your suggestion.

0 Kudos

hi manan ,

have u tried the steps i suggested above .

regards

ranjan

0 Kudos

Dear Ranjan,

The way you gave that I already tried out but user wants the data in xls format and dont want to change file formation also by save as. So he just want it by the way of local file. So this is the condition they provided.

0 Kudos

Hello Manan,

In the ALV Program code, you have to

SET PROPERTY OF go_cell 'NumberFormat' = '@'.

this will set the Excel cell to Text type and + sign wont get lost.

Cheers

Sandy

Former Member
0 Kudos

Hi,

Use data type 'C' for mobile no in your program . you will get answer.

data mobile_no(12) type c.

mobile_no = '+919876543221'

Ram.

Former Member
0 Kudos

Hi,

Declare the Mobile number field as a Character field and append it to the Final output table and download it using 'GUI_DOWNLOAD' and make sure that the file type is 'DBF'.

Below is the sample code to save the output as a local file in your system.

TYPES: BEGIN OF ty_output,

mob(20) TYPE c,

END OF ty_output.

DATA: BEGIN OF it_title OCCURS 2,

title(100),

END OF it_title,

gt_output TYPE TABLE OF ty_output WITH HEADER LINE,

wa_layout TYPE slis_layout_alv,

wa_fldcat TYPE slis_fieldcat_alv,

gt_fldcat TYPE TABLE OF slis_fieldcat_alv,

ofname TYPE string.

gt_output-mob = '+919876543210'.

APPEND gt_output.

gt_output-mob = '+91123456789'.

APPEND gt_output.

CONCATENATE 'D:\temp\' 'MOBILE_' sy-uzeit '.xls' INTO OFNAME.

it_title-title = 'Mobile Num'.

APPEND it_title.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = ofname

filetype = 'DBF'

write_field_separator = 'X'

TABLES

data_tab = gt_output

fieldnames = it_title.

IF sy-subrc = 0.

ENDIF.

Please reward if the solution is useful.