Download datas from SAP to Excel in OO
Hallo,
i create an excel-document with the methods
CALL METHOD DOCUMENT->CREATE_DOCUMENT
EXPORTING
OPEN_INPLACE = ' '
* CREATE_VIEW_DATA = CREATE_VIEW_DATA
* ONSAVE_MACRO = ONSAVE_MACRO
* STARTUP_MACRO = STARTUP_MACRO
DOCUMENT_TITLE = DOCUMENT_TITLE
NO_FLUSH = NO_FLUSH
IMPORTING
ERROR = ERROR
RETCODE = RETCODE.
and
CALL METHOD DOCUMENT->GET_SPREADSHEET_INTERFACE
EXPORTING
NO_FLUSH = NO_FLUSH
IMPORTING
SHEET_INTERFACE = SPREADSHEET
RETCODE = RETCODE
ERROR = ERROR.
and so on.
Wounderful.
I close the excelwindow with the methods:
CALL METHOD DOCUMENT->SAVE_AS
EXPORTING
* FILE_NAME = FILE_NAME
PROMPT_USER = 'X'
NO_FLUSH = NO_FLUSH
IMPORTING
ERROR = ERROR
RETCODE = RETCODE.
PERFORM FEHLERPRUEFUNG.
CALL METHOD DOCUMENT->CLOSE_DOCUMENT
EXPORTING
DO_SAVE = DO_SAVE
NO_FLUSH = NO_FLUSH
IMPORTING
HAS_CHANGED = HAS_CHANGED
ERROR = ERROR
RETCODE = RETCODE.
PERFORM FEHLERPRUEFUNG.
CALL METHOD DOCUMENT->RELEASE_DOCUMENT
EXPORTING
NO_FLUSH = NO_FLUSH
IMPORTING
ERROR = ERROR
RETCODE = RETCODE.
PERFORM FEHLERPRUEFUNG.
FREE DOCUMENT.
Only the worksheet is closed but not the excel-window.
Has anybody an idea what is wrong?
Thank you.
Greetings
datatom
Hallo,
i create an excel-document with the methods
CALL METHOD DOCUMENT->CREATE_DOCUMENT
EXPORTING
OPEN_INPLACE = ' '
* CREATE_VIEW_DATA = CREATE_VIEW_DATA
* ONSAVE_MACRO = ONSAVE_MACRO
* STARTUP_MACRO = STARTUP_MACRO
DOCUMENT_TITLE = DOCUMENT_TITLE
NO_FLUSH = NO_FLUSH
IMPORTING
ERROR = ERROR
RETCODE = RETCODE.
and
CALL METHOD DOCUMENT->GET_SPREADSHEET_INTERFACE
EXPORTING
NO_FLUSH = NO_FLUSH
IMPORTING
SHEET_INTERFACE = SPREADSHEET
RETCODE = RETCODE
ERROR = ERROR.
and so on.
Wounderful.
I close the excelwindow with the methods:
CALL METHOD DOCUMENT->SAVE_AS
EXPORTING
* FILE_NAME = FILE_NAME
PROMPT_USER = 'X'
NO_FLUSH = NO_FLUSH
IMPORTING
ERROR = ERROR
RETCODE = RETCODE.
PERFORM FEHLERPRUEFUNG.
CALL METHOD DOCUMENT->CLOSE_DOCUMENT
EXPORTING
DO_SAVE = DO_SAVE
NO_FLUSH = NO_FLUSH
IMPORTING
HAS_CHANGED = HAS_CHANGED
ERROR = ERROR
RETCODE = RETCODE.
PERFORM FEHLERPRUEFUNG.
CALL METHOD DOCUMENT->RELEASE_DOCUMENT
EXPORTING
NO_FLUSH = NO_FLUSH
IMPORTING
ERROR = ERROR
RETCODE = RETCODE.
PERFORM FEHLERPRUEFUNG.
FREE DOCUMENT.
Only the worksheet is closed but not the excel-window.
Has anybody an idea what is wrong?
Thank you.
Greetings
datatom
Similar Messages
-
How to download data from itab to Excel sheet..
Hi sap Experts,
I develop one report to download data from itab to excel sheet.I done it perfectly.
My doubt is in the excel sheet i need to put headings. and also at last i need to display total no.of Records.
Please help me how to do this.
Thanks in Advance....
Thanks and Regards
Siri.......................u can either use GUI_DOWNLOAD or the method below...just give a try
DATA:WK_string TYPE STRING.
DATA:Wk_EXT(4) TYPE C value '.xls'.
DATA:WK_path TYPE STRING.
DATA:wk_file_name type string.
data:wk_records type sy-tfill.
wk_file_name = 'Downloaded'.
describe table itab lines wk_records.
LOOP AT ITAB.
at first.
**Provide path
concatenate 'C:\' wk_file_name Wk_EXT into wk_path.
open dataset WK_path for output in text mode encoding default.
if sy-subrc 0.
write:'ERROR while opening dataset !!!!!!'.
EXIT.
endif.
CONDENSE wk_path.
**Heading Part
concatenate 'Part No' 'Description'
into wk_string separated by cl_abap_char_utilities=>horizontal_tab.
endat.
**Data ITAB
CONCATENATE ITAB-MATNR itab-maktx into wk_string
separated by cl_abap_char_utilities=>horizontal_tab.
transfer wk_string to WK_path.
at last.
clear wk_string.
Concatenate 'Records Passed:' wk_string into wk_string.
transfer wk_string to WK_path.
close dataset WK_path.
endat.
endloop. -
Download data from ui to excel
Hello Experts,
We have a requirement wherein, we need to download data from SAP CRM Web-ui (Assignment Block/View) to excel sheet(CSV) using a custom button.
Kindly help me in doing so.
Thanks,
Anubhuti DixitHey Guys,
anybody has a answer on this issue? -
Hi All,
I am downloading a data from SAP to excel(*.xlsx) format. I am able to conver/download the file in *.xlsx format, but if try to open the downloaded excel file, it gives teh error message 'Excel cannot open the file 'filename.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file'. with a OK button. When I press the OK button, no data is displayed.
So kindly let me know how to download the file from SAP to *.xlsx format without any errors.
Note: I am able to download the data in *.xls format without any erros.
Thanks in advance,
Regards,
VijayHi,
You are probably not being able to open the file of .XLSX format because you do not have Microsoft Office 2007 installed on your system. You might be having a lower version of Microsoft Office. e.g. 2003.
What you can do is, before opening the .XLSX file directly on a system which does not have Microsoft Office 2007, you can convert it into .XLS format and then open the same.
See the below code.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY
EXPORTING
SOURCE = 'C:\Users\Danish\Desktop\test1.xlsx'
DESTINATION = 'C:\Users\Danish\Desktop\test2.xls'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
DISK_FULL = 4
ACCESS_DENIED = 5
FILE_NOT_FOUND = 6
DESTINATION_EXISTS = 7
UNKNOWN_ERROR = 8
PATH_NOT_FOUND = 9
DISK_WRITE_PROTECT = 10
DRIVE_NOT_READY = 11
NOT_SUPPORTED_BY_GUI = 12
OTHERS = 13.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Danish -
How to download data from spool to excel file
Hi,
I have requirement like....i need to download data from spool to excel file.
Please let me know the process how to download...
<removed by moderator>
<removed by moderator>
Thanks,
Khasimsa
Moderator message: please (re)search yourself before asking, do not assign priorities, do not offer re-ward
locked by: Thomas Zloch on Sep 8, 2010 1:18 PMHi try this way..
*FM called that returns the Spool Request Number data into and internal table
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
EXPORTING
rqident = p_spool "Spool Request Number
first_line = 1
TABLES
buffer = it_spool_xls "Internal table that will have the Spool Request No data
EXCEPTIONS
no_such_job = 1
not_abap_list = 2
job_contains_no_data = 3
selection_empty = 4
no_permission = 5
can_not_access = 6
read_error = 7
OTHERS = 8.
*To convert the spool data into excel format
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = it_spool_xls "Internal table having spool data
objcont_new = it_xls_spool. "Int table having Excel format data converted from Spool data
"call GUI down Load by passing it_xls_spool
Prabhudas -
How to provide a button in bsp that downloads data from SAP into powerpoint
hi,
how to provide a button in bsp that downloads data from SAP into powerpoint
this absurd requirement is needed by my client.
thanks
saadHi,
Look at tools like the things mentioned above or things like
http://www.investintech.com/products/developer/creatorsdk/creatorsdkmain/
http://command-line-image-converter.qarchive.org/
You need to look for tools that can run via the command line and thsu be executed as external command (http://help.sap.com/saphelp_nw2004s/helpdata/en/fa/0971d4543b11d1898e0000e8322d00/frameset.htm)
Eddy
PS. Reward the useful answers and you will get <a href="http:///people/baris.buyuktanir2/blog/2007/04/04/point-for-points-reward-yourself">one point</a> yourself! -
Download data from cube to excel
Hello gurus.
I need to download data from a cube to excel... but is not possible to download all the data, because excel restrictions.
Do you know a way to download all the data?
Thanks in advance,
Vitor RamalhoOpen Hub Service can be invoked either directly as a transaction in the BW GUI
( RSBO ) or using the menu item u201CToolsu201D in the administrator workbench ( transaction
RSA1 )
Check the below link for further details.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7d63ec90-0201-0010-a2a7-898c08c589f8 -
Download data from memory to Excel format.
Hi Gurus,
How can I download data from Memory( not in application server ) to Excel format ? Now I am using below function modules but not coming in proper format.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'LIST_TO_ASCI' "report to ASCII text
TABLES
listasci = listasci
listobject = listobject
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.Hi,
use this function module.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
Regards,
NNR. -
S_ALR_87011990 - Problem in downloading report from SAP to Excel.
Hi All,
I am facing an issue in report S_ALR_87011990, while downloading a report from SAP to excel. In SAP, report is comming out to be in different format than what it is getting generated in excel.
I am attaching screen shots for your reference.
Request you all to kindly help me in this regard, As this report is required urgently.
Thanks in advance....
Regards
Rajat KumarHi Priya,
Sorry for the delay.. here
Simple explanation...
ABAP - OLE Automation using MS-Excel - Code Gallery - SCN Wiki
You can find a detail doc here
http://www.heyiamonline.com/abap/pdf/ABAPOLEAUTOMATION.pdf
Regards -
Download data from itab to excel in background (POINTS WILL BE REWARDED )
Hi Guys...
Is it possible to transfer data from an internal table to excel through a report which runs in background...???
thnx in advance...Please refer following code.
LOOP AT IT_EXCEL_LAYOUT.
CONCATENATE: IT_EXCEL_LAYOUT-SLNO ','
IT_EXCEL_LAYOUT-HERST ','
IT_EXCEL_LAYOUT-QMNUM ','
IT_EXCEL_LAYOUT-QERDAT ','
IT_EXCEL_LAYOUT-AUFNR ','
IT_EXCEL_LAYOUT-ERDAT ','
IT_EXCEL_LAYOUT-EBELN ','
IT_EXCEL_LAYOUT-AEDAT ','
IT_EXCEL_LAYOUT-BELNR_M ','
IT_EXCEL_LAYOUT-BSART ','
IT_EXCEL_LAYOUT-MATNR ','
IT_EXCEL_LAYOUT-TXZ01 ','
IT_EXCEL_LAYOUT-MTART ','
IT_EXCEL_LAYOUT-MENGE ','
IT_EXCEL_LAYOUT-CBAMT ','
IT_EXCEL_LAYOUT-MMCRAMT ','
IT_EXCEL_LAYOUT-CRN_NO ','
IT_EXCEL_LAYOUT-MMDBAMT ','
IT_EXCEL_LAYOUT-DBN_NO ','
IT_EXCEL_LAYOUT-REJAMOUNT ','
IT_EXCEL_LAYOUT-DBN_REJ_CODE_TEXT','
IT_EXCEL_LAYOUT-STAMT ','
IT_EXCEL_LAYOUT-STXCAMT ','
IT_EXCEL_LAYOUT-CRNNO ','
IT_EXCEL_LAYOUT-LRNO ','
IT_EXCEL_LAYOUT-LRDATE ','
IT_EXCEL_LAYOUT-TRANSPORTERNAME
INTO IT_EXCEL-FLD.
APPEND IT_EXCEL.
ENDLOOP.
DATA:w_filename LIKE CFFILE-FILENAME.
CONCATENATE '/usr/sap/EC2/SYS/global/backup/'SY-UNAME '.csv' INTO w_filename.
OPEN DATASET w_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
LOOP AT IT_EXCEL.
TRANSFER IT_EXCEL TO w_filename.
ENDLOOP.
ENDIF.
CLOSE DATASET w_filename.
It will help u to download data on to application server in csv format
Regards,
Swarup -
Download data from ALV to excel issue
Hi All,
Could you please tell me if there has any restriction on ALV grid data download to excel? I've a report contains 68 columns and about 500 rows, I want to download the data using the standard menu list->export->save to local file. but after I download them, I found the first 65 columns display in one line and the rest columns display in next line, just like ALV do not allow too many characters in one row and have to switch to new line. I can hide some columns but it's very strange that even after i hide 3 columns to fit the 500 rows download, then if the rows increase, the same problem occurs.
I searched the forum and in the thread Re: Export ALV in EXCEL Issue Mr. Suvajit provided a solution by using menu List->export->spreadsheet, it looks very good. But I still want to know how this happen and is there a standard way to download data with more than 65 columns to local file with extension .xls so that user can open it directly?
PS: I'm using FM REUSE_ALV_GRID_DISPLAY and the SAP version is SAP ECC6 with kernal package SAPKB70103.
Thank you very much.
Best Regards,
Jeff
Edited by: Jeff_liu_2010 on Mar 10, 2011 7:21 AMHi Jeff,
Please check if following analysis is helpful to you.
Analysis/Solution:
When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
(I never faced any issue related to no of columns as it worked fine for columns >90 too)
Issue occured when row size of exported data gets more than 1023 character.
Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
One additional aspect generally missed is that:
When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
Reducing the header size (by forcing to use short text or specifying own header names) should resolve the issue.
Regards,
Parveen -
Download data from jsp to Excel
Originally, when I was using tomcat as the web server (installed at my local machine), I wrote a jsp which allows users to download Oracle table data to a Excel file. When the user clicks "Download" data, a "File Download" dialog box pops up and asks whether the user want to "Open this file from its current location" or "Save this file to disk". That is what I want.
Now, I migrate the application to OC4J (installed at Sun Solaris Server), the same program is not working as the same way as above. If the user clicks the link, then the program simply display the jsp page. In order to download data, the user needs to right click the link and selects "Save Target as".
How to make the application work just like it works on tomcat? Is this a programming issue or a server configuration issue?
Thanks.
JingzhiHi,
I am having the same exact problem that you had months ago. Would love to hear if you came up with a solution? Original post included below...
Thanks,
Andres
ORIGINAL POST:
Hi
I could successfully send the data from a jsp file to a excel file. But, I have a problem with the data. The data i pass is normally alpha numeric, but some times the data is something like '00123456'. In such cases, i am loosing the leading zeros and get '123456'. Is there any way i can get around with this problem?
Help is greatly appreciated.
Bharat -
Download Data from OBIEE to Excel using Macro (ODBC connection)
Hi,
We have OBIEE used as data source for reporting. Currently we manually go into OBIEE and download the report in Excel Format. However we want that to be automated by writing a macro and connecting directly do the DB and querying the data.
Do anyone have the details on how to connect to OBIEE using Excel Macros? I am not a Oracle developer and I am not allowed to install any software in my system. So if there is a way I can connect, please let me know. Thanks so much for you help.download oracle bi for microsoft office software available in obiee>>answers>>more products. login to obiee to get it and once you installed then you can directly connect to obiee from excel itself and download report.
Thanks
Jay. -
Problem while opening data from mysql in Excel
Hi friends
when i try to download data from MySQL to excel sheet I am getting error of
This file is not in a recognizable format.
. If you know the file is from another program which is incompatible with Microsoft Office Excel,click Cancel then open this file in its original application.If you want to open the file later in Microsoft Office Excel,save it in a format that is compatible,such as text format.
etc
Code is
Class.forName("org.gjt.mm.mysql.Driver");
Connection conn = DriverManager.getConnection("xxxxxx");
Statement st = conn.createStatement();
StringBuffer sb = new StringBuffer();
sb.append("SAP#" + "\t");
sb.append("x-plant status" + "\t");
sb.append("Total Amount" +"\t");
sb.append(">90 days" + "\t");
sb.append("\n");
try
String query="select * from temp_Xplant";
ResultSet rs = st.executeQuery(query);
while(rs.next()){
sb.append(rs.getString("sapNo") + "\t");
sb.append(rs.getString("status")+ "\t");
sb.append(rs.getString("amt") + "\t");
sb.append(rs.getString("days") + "\t");
sb.append("\n");
conn.close();
st.close();
catch (Exception e)
out.println("error");
conn.close();
st.close();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=\"test.XLS\"");
I can open them after clicking OK, but before that it is showing the above error message
Thank you
Edited by: priyap on Apr 3, 2008 4:54 AMhi,
there are some specific restrictions in downloading data in alv.
i.e you cannot have morethan 1024 characters that can be downloaded in single row.
so change your report columns accordingly. -
From sap to excel file with different sheets?
can i upload an internal table from SAP to single Excel file with different sheets for example like : sheet1, sheet2, sheet3.......sheet10. , but need to upload data from sap to excel worksheets ie. from multiple named tabs in Excel. Is this possible, and if so, please can you help and advise me how?
thanks
venkat.
Edited by: Matt on Feb 16, 2009 2:15 PM Removed excessive question marks...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Hi venkat,
Yes indeed it is possible to write data from internal table to different excel sheets. Check out SAP's Microsoft OLE functionality.Search on SDN for OLE . Following are some links
https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/sample%252bprogram%252bto%252bopen%252bexcel%252bsheet%252busing%252bole
You can also check out FM ALSM_EXCEL_TO_INTERNAL_TABLE to check how to read different worksheets.
Using the above two resources you can create a program that can upload data to multiple worksheets in the same workbook.
Also see this link
Creating Excel with More than one page
Edited by: aditya aghor on Feb 16, 2009 1:57 PM
Edited by: aditya aghor on Feb 16, 2009 2:02 PM
Maybe you are looking for
-
Why is Photoshop CC 2014 nearly crash with Wacom and fix itself when I move my regular mouse?
I have Photoshop CC 2014 (completely updated through Creative Cloud). I am currently using a Wacom Intuos 3 9"X12" with the Intuos drivers all updated. Everything is updated. I am working on Windows 8, on a computer with 8 GB's of RAM. I have never h
-
Premiere Elements cause problems with Windows Media Center while streaming to TV.
I was having the following problem: The audio from the streaming process of a recorded TV show on my HP computer to the remote receivers, a Sony Blu-ray player and/or a Sony Streaming Player, results in the loss of audio signal at exactly 30 seconds
-
Crystal report to weblogic workshop
hi, using crystal reports 10 to define template reports and trying to view them thru an application in workshop. i connect from reports to the db using a system dsn "X". This DSN is the same as the datasource configured in my workshop app server. The
-
I can't upload my free iBook into iTunes Producer
I am done with my iBook. It will be available free and as such I opened a free iBook account with Apple. I downloaded iTunes Producer (latest version). I open iTunes producer and follow the needed steps, filling up all information; including cover im
-
How to exit modal window(dialog) so that cursor return to main document window.