ALV list download as Excel
Hell ALL Dear!
An output of an internal table occurs via ALV-Grid but also is needed
the possibility to download this list to as Excel_FIle.
How can it be implemeted?
Regards
Ilhan
when the List is displayed....
Goto Menubar.
<b>List---->Export--
>Local File</b>
after this you will get a dialog box with some radio buttons
there u select <b>Spreadsheet.</b>
after that you will be asked to specify the path and the file name.....
Just do that your problem will be solved....
if helpful reward points.
Regards,
Vivekananda Varma Dandu
Similar Messages
-
ALV List download to Excel format
hi all,
how to download ALV list to excel?
i am using Reuse_ALV_List_Display fm to get my list .Hi,
You dont have to do anything extra as such coz transport to excel is already given in the toolbar of the ALV Check report BALVSD04.
But still you wanna download it then download the final table by using any of the download functions ' GUI_DOWNLOAD' , ' CONVER_SAP_TO_XLS', etc.
Regards,
Amit
Reward all helpful replies. -
Using download button in ALV to download to excel
Hi,
Please provide me the solution on using download button in Hierarchial List ALV to download to excel.I need to download the Header and Item details in a single line (in one line)in the Excel sheet.
Please suggest the solution and sample code ASAP.
Thanks and Regards,
Latha.Hi Rames,
my mail id : [email protected]
Thanks and Regards,
Vidyullatha. -
ALV grid Download to excel not working
Hi All,
I am displaying an Alv list using the function Module
REUSE_ALV_GRID_DISPLAY.
The report is getting displayed correctly..But when Iam trying to downlaod the same in excel.It does not get downloaded correctly.
All the fields get downloaded into one column of excel sheet.
CAn anyone tell me what's going wrong on this.
Thanks
GTHi GT,
try this way,
save as local file this option available on the grid.
and while giving the file name give the name what you want with extension .xls
then check that file all the data will be opend in excel sheet.
http://help.sap.com/saphelp_erp2004/helpdata/en/e3/41a138c4397a42e10000009b38f842/frameset.htm
reward points for helpfull answers and close the thread if your question is solved.
regards,
venu. -
Reg: ALV output download using excel option
Hi Team,
I created a report using ALV Function modules, I want to download in Excel sheet the output list. i am trying to download but i am not getting proper values. I am populating around 50 fileds.
is there any settings for these download.
<<removed by moderator>>
Thanks & Regards,
Mahendar patha.hi mahendra;
use this step-by-step procedure it will help u a lot:
Firstly export the data to memory using the FM LIST_FROM_MEMORY.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = t_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc 0.
MESSAGE e000(su) WITH text-001.
ENDIF.
then i converted it into ASCII using LIST_TO_ASCI,
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = t_xlstab
listobject = t_listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE e003(yuksdbfzs).
ENDIF.
This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
cl_abap_char_utilities=>horizontal_tab.
Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
This will create an excel attachment.
Sample code for formatting the data for the attachment in excel format.
u2022 Format the data for excel file download
LOOP AT t_xlstab INTO wa_xlstab .
DESCRIBE TABLE t_xlstab LINES lw_cnt.
CLEAR lw_sytabix.
lw_sytabix = sy-tabix.
u2022 If not new line then replace '|' by tabs
IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
WITH cl_abap_char_utilities=>horizontal_tab.
MODIFY t_xlstab FROM wa_xlstab .
CLEAR wa_xlstab.
wa_xlstab = cl_abap_char_utilities=>newline.
IF lw_cnt NE 0 .
lw_sytabix = lw_sytabix + 1.
u2022 Insert new line for the excel data
INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
lw_cnt = lw_cnt - 1.
ENDIF.
CLEAR wa_xlstab.
ENDIF.
ENDLOOP.
Sample code for creating attachment and sending mail:
FORM send_mail .
u2022 Define the attachment format
lw_doc_type = 'XLS'.
u2022 Create the document which is to be sent
lwa_doc_chng-obj_name = 'List'.
lwa_doc_chng-obj_descr = w_subject. "Subject
lwa_doc_chng-obj_langu = sy-langu.
u2022 Fill the document data and get size of message
LOOP AT t_message.
lt_objtxt = t_message-line.
APPEND lt_objtxt.
ENDLOOP.
DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE lt_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-sensitivty = 'F'.
ELSE.
lwa_doc_chng-doc_size = 0.
ENDIF.
u2022 Fill Packing List For the body of e-mail
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = 'RAW'.
APPEND lt_packing_list.
u2022 Create the attachment (the list itself)
DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
u2022 Fill the fields of the packing_list for creating the attachment:
lt_packing_list-transf_bin = 'X'.
lt_packing_list-head_start = 1.
lt_packing_list-head_num = 0.
lt_packing_list-body_start = 1.
lt_packing_list-body_num = lw_tab_lines.
lt_packing_list-doc_type = lw_doc_type.
lt_packing_list-obj_name = 'Attach'.
lt_packing_list-obj_descr = w_docdesc.
lt_packing_list-doc_size = lw_tab_lines * 255.
APPEND lt_packing_list.
u2022 Fill the mail recipient list
lt_reclist-rec_type = 'U'.
LOOP AT t_recipient_list.
lt_reclist-receiver = t_recipient_list-address.
APPEND lt_reclist.
ENDLOOP.
u2022 Finally send E-Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = lw_sent_to_all
TABLES
packing_list = lt_packing_list
object_header = lt_objhead
contents_bin = t_xlstab
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Hope it will help you
Regards
Rahul sharma
Edited by: RAHUL SHARMA on Nov 4, 2008 1:22 PM -
Hi Friends,
I want to save the ALV output as a excel file on local drive.
From the ALV output, I am using menu path : Views --> Microsoft Excel (Ctrl + Shift + F7) to switch from ALV to Excel mode.
It is switched to excel mode but not showing any data in the columns?
If I use the Path: List --> Export --> Local File --> Spread Sheet --> Gave excel file name.
Here, I am not able get data for all columns. Some columns are not being displayed.
What is the problem in this? Is this coding error? Do we need to apply any OSS notes?
Thanks in advance,
SreeniHi soumya,
I want to download from standard functionality only, that means I want to download using standard menu paths only.
I have tried giving .csv file also, but not able to download all fields. It is missing first 4 fields and downloading all the remaining
fields.
Please try to through some light on it.
Thanks in advance,
Sreenivas reddy -
ALV output download to excel with top of page
Hi,
i want to download ALV grid output to excel sheet including the top of page. i am using the icon in application tool bar. but only data's are download to excel sheet. i cannot download the top of page. with out write coding in program can we download it. if yes pls explain.
thanks.I'm sorry but I can't find FM with DOWNLOAD_EXCEL_*.
I want to know more detail thing.
plz. give answer to me anytime.
I'm waiting..
Edited by: Kwang Seop Kim on Sep 26, 2008 6:57 AM -
Function module to save the data from ALV list to MS Excel file
Hi,
I am displaying an ALV list.
I am assigning a pushbutton in the GUI status to save the list as a MS Excel file.
Can you please let me know the function module to achieve this task.
I tried 'SAP_CONVERT_TO_XLS_FORMAT' FM but it is giving some type confict error.
Thanks & Regards,
Balaji.RALV has this option built in, you may also find FM like [ALV_XXL_CALL|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=alv_xxl_call&adv=false&sortby=cm_rnd_rankvalue].
Can you elaborate a little more on your need, why adding an option that already exits?
Regards -
Doubt on ALV report download to EXCEL
Hi All,
i have written a report with ALV_GRID FM, by default we get the option to download the output to excel. But when we click on the download to excel, it displays the output
in the frist page, but it also opens so many pages like
format, header, pivot,sub1,sub1....etc.
Pls. check the SAP standard report BCALV_TEST_FULLSCREEN, does the same thing when we do download to excel.
How can i avoid opening so many pages in excel?
Thanks for the help.
SekarHi ,
prabhu here , i think check the FM wheather u r passing all these to FM. for Excel keep export.param: --> i_save only and check.
regards
prabhu -
ALV colouring download to excel sheet
Hi Experts ,
I have a requirement in which I have coloured the cells of the ALV display , in order to highlight them.
I have made use of 'REUSE_ALV_GRID_DISPLAY' FM for displaying ALV.
When I download this output to an excel sheet , the colour filled in various cells disappears.
Can someone let me know that , is it possible to retain this colour of the cell even after ALV download to an excel sheet?
Thanks in Advance !!!Hi retwika
I had searched on this previously and found out the following code,for download a report to excel with format (border, color cell, etc)
REPORT ZSIRI NO STANDARD PAGE HEADING.
* this report demonstrates how to send some ABAP data to an
* EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
* handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
TABLES: SPFLI.
DATA H TYPE I.
* table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
* read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
* display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
* display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
* start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
* PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
* CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
* PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
* get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
* add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
* copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
* changes by Kishore - start
* CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
* add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
PERFORM ERR_HDL.
* tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
* copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
* changes by Kishore - end
* disconnect from Excel
* CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
* FORM FILL_CELL *
* sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
* outputs OLE error if any *
* --> p1 text
* <-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
Look out the changes
Revert if any prblem
Thanks and Regards
Srikanth.P -
Alv output download to excel sheet spliting into three line
hi,
i have developed alv report with 62 fields (62 colums).when i download this output into excel sheet each line spliting into three line.each field has 20 char length.i want download each row as single line.
i am using local file (ctrl + shift+F9) -> spreadsheet option
please advice me to solve this issue. i am using fm REUSE_ALV_GRID_DISPLAY.
In layout i am using
DATA: min_linesize like sy-linsz, " if initial min_linesize = 80
max_linesize like sy-linsz. " Default 250
min_linesize = 100.
max_linesize = 1000.
gt_layout-zebra = 'X'. "space.
gt_layout-colwidth_optimize = space.
gt_layout-max_linesize = min_linesize.
gt_layout-max_linesize = max_linesize.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET-PF-STATUS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = gt_fieldcat[]
it_events = gt_events[]
is_layout = gt_layout
is_variant = v_stru_disvar
i_default = 'X'
i_save = 'A'
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final[]
EXCEPTIONS
program_error = 1
OTHERS = 2
Edited by: Raja Ram on Aug 4, 2009 12:40 PMsolved
-
Background report list download to excel
I run an ALV hierarchical sequential report in background. Then when I download the report output ( thro SM37 ) to excel, the whole output of the report comes in one cell ( excel ). In other words the columns of the report will not appear in excel.
for example:
I have 3 columns and 4 rows as the report output ( in SM37 ). When I download it to excel, the excel will have only 1 column and 4 rows.
I need info on making the excel output to look same as the report output; in terms of column.Hi Amit,
Actually I do have a similar issue. I have a report which output is in the form of excel sheet. I developed using ole2 objects. I have a lot of customization like colors, heading and different margins. Is there any way can I run it in background. I cannot save it in shared folders su01 because it does not support ole objects. Actually, If I run this program in foreground now, The form gets loaded with all the data, it saves the file in the given path , and then closes the file. But, when I run it in as a background job, the data is not getting loaded. Is there any other way to run this in background.
Krishna. -
ALV List export to Excel when program is run in background
Hello,
I am running into an issue with a custom ALV report which contains an export to Excel option on the input screen. However, when I attempt to run the report in background due to high volume of records/expected performance constraints, the job fails to produce a spool when the "export to Excel" option is selected. When I deselect that option, the background job successfully generates a spool, which I can then export to Excel (albeit the formatting will not look the same).
Is the above an accurate statement or does anyone know of a way where either;
1) The background job can create and store the Excel output into a cached directory?
2) The spool generated, when exported to Excel, can match the format of the foreground Excel output?
Thanks in advancce.Check out the sample program of the provided link ..
http://www.sap-img.com/abap/download-in-background-in-excel-format.htm -
Reg: ALV report download to excel currency columns
Hi All,
While downloading the alv report to excel, currency fields with negative sign(less than 0) is downloading without negative sign.
And field catalog wad declared as 'CURR' field for that particular column, if I declared as 'CHAR', i am getting shortdump.
Can any one tell me how to get the negative sign.
Thanks in advance.Hi,
Do you use ALV to excel standard functionality or your own code to excel?
Please provide more information.
Thanks, -
Main heading and Sub Heading Requirment in ALV wih download to excel featur
Hello Everyone,
I have a very typical requirment in ALV . I want the output to be displayed as folows :
Category
Head1
Head2
Here the heading category is just a heading and no header and line item data. so hirearchal kind of ALV is of no use. and i cant write this was in TOP-OF-PAGE as i want to download this data to excel and if i write it in TOP-OF-PAGE the dwnload in excel is misaligned. I have been thorugh the various topics posted here and couldn't get a feasible solution. Please Help.Hi,
This is not possible
Refer these links
Re: ALV query
Re: Multiple lines in alv column headings
If this solves ur problem reward points and close the thread
Maybe you are looking for
-
Can't play manually added videos since upgrading to IOS 8
Since upgrading to IOS 8, my iPhone 5 won't play any videos that I copy to the device manually through iTunes. These are videos that I've played on the iPhone before, so I know they are compatible and of the correct format. Basically what is happenin
-
Mac Mini 4k display @60Hz?
Is it possible to get 4k @60Hz on a mac mini over DisplayPort or does this only work for mac pros and macbook retinas? If this is possible on the mac mini, would it then be possible to get a DisplayPort to HDMI 1.4 converter and then plug in a 4k dis
-
have just installed Microsoft word on iPad all the templates are underlined in English but when you open them they are in a different language
-
Current Calendar Day on Selection Screen as Default
Hi, I have a situation where i need to have a variable which pulls up current calender day as a default value in the selection screen. Here users can use the default value if they want or else they should be able to change the default value to their
-
Might have a virus help me!!!
My iPod has an app that I can not delete no matter what I do and it isn't downloaded all the way so its weird. Ever science I downloaded it my iPod has been acting really glitchy and weird. I synced it with my computer and now my computer is acting w