Sql output in Excel file
Hello all ,
I have to save my sql query output to a .xls file.i want to save that file in Unix folder.
Can anyone help me out to do it
Thanks in advance
I am able to create .xls file using UTL_FILE but with some seperater so when i open that built .xls file i have to convert text to column utility again ..
I dont want to use that step directly from Oracle to .xls format i want the output
Similar Messages
-
How to run the report and show the output in excel file
salam
how to run the report and show the output in excel file,
how to run the report and print the o/p via printer
how to run the report and send the o/p via mail
thank u allHi,
There are Parameters DESTTYPE, DESFORMAT and DESNAME. You can set these parameters to get as you want.
1) Output in Excel File
ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'FILE');
ADD_PARAMETER(PL_ID, 'DESFORMAT', TEXT_PARAMETER, 'DELIMITED');
ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<file_name>.XLS');2) output to printer
ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'PRINTER');
ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<printer_name>');3) Email - Have to configure SMTP and all. ( i didn't checked it)
ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'MAIL');
ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<email_id>');Regards,
Manu.
If this answer is helpful or correct, please mark it. Thanks. -
Hi All,
I am downloading the ALV output to Excel file.I am making use of LIST--->EXPORT--->SPREADSHEET option.
My list is having Header, Footer, sub totals and totals.When i transfer the list i am facing following problems
1.Even i am getting the empty columns betweeen my output.
2.In the Place of sub totals i am getting astericks
3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top
Thanks,
Ravee...Hello Vinod,
1.I am getting the empty columns betweeen my output.
I am having 16 columns in the ALV output,but i got 19 columns in my excel file.
2.In the Place of sub totals i am getting astericks.
Generally there is no possibility to download the sub totals.i am using LIST->EXPORT->SPREADSHEET.
I am having the sub totals in my output.
*You would have noticed the' * ' for sub total and ' ** ' for grand totals values.*These sub total & total values are not downloaded but these asterisks are carried to excel file.
3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top.
I am using the application tool bar icon only.Still i am getting the same.
Thanks,
Ravee... -
How to download a smartform output as excel file WITH EXACT LAYOUT.
Hi,
I have searched the forum but could not found any satisfactory answer. I have a smartform with a table, some texts and a logo. I have to write a code which will save the smartform output as excel file in the system keeping the layout of the smartform output EXACT.
i.e., the excel file will contain the output with EXACTLY THE SAME layout as would have been for a pdf file (if the smartform output is converted to a pdf file) and the client can then edit the fields of the table in the excel file. How can I achieve this? Please give a suggestion.. Thanks in advance.Hi Anirban,
Your Requirement is to download a smartform to microsoft Excel .
Well unfortunately we can only download data into excel which is in a tabular format i.e stored in internal tables we have function modules to do the same even u can do that using OLE2.
If u try to download a smartform to Excel only format supported will be ASCII, if u will continue with that the smartforms text's will get downloaded to excel but whole data would be downloaded in a single Cell.
Code to do the same is -
>>>>
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = v_language
i_application = 'SAPDEFAULT'
IMPORTING
e_devtype = v_e_devtype.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = w_form
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = w_fmname
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE E002(zcpm) WITH 'Smartform call fails'.
ENDIF.
wa_outopt-tdprinter = v_e_devtype.
wa_ctrlop-no_dialog = 'X'.
wa_ctrlop-getotf = 'X'.
CALL FUNCTION w_fmname "'/1BCDWB/SF00000025'
EXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = WA_CTRLOP
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = WA_OUTOPT
* USER_SETTINGS = ' '
IMPORTING
* DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_OTFDATA
* JOB_OUTPUT_OPTIONS =
* document_output_info = st_document_output_info
* job_output_info = st_job_output_info
* job_output_options = st_job_output_options
TABLES
T_FINAL = T_FINAL
T_ZSDT_WAGONS = T_ZSDT_WAGONS_1
T_QTY = T_QTY
T_QTY1 = T_QTY1
T_CON1 = T_CON1
T_CON2 = T_CON2
"T_ZTMM_OUTWB_TXN = T_ZTMM_OUTWB_TXN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
T_OTF[] = T_OTFDATA-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'ASCII'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if tabix_m = 1.
*CALL METHOD cl_gui_frontend_services=>file_save_dialog
*CHANGING
*filename = w_FILE_NAME
*path = w_FILE_PATH
*fullpath = w_FULL_PATH
** USER_ACTION =
** FILE_ENCODING =
*EXCEPTIONS
*CNTL_ERROR = 1
*ERROR_NO_GUI = 2
*NOT_SUPPORTED_BY_GUI = 3
*others = 4
*IF sy-subrc <> 0.
*MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
CALL function 'TMP_GUI_BROWSE_FOR_FOLDER'
EXPORTING
WINDOW_TITLE = 'Select A File Folder'
INITIAL_FOLDER = 'C:\'
IMPORTING
SELECTED_FOLDER = W_PATH.
endif.
CONDENSE W_PATH.
concatenate W_PATH '\' wa_final-vbeln '.XLS' into w_FULL_PATH.
****************************************************************************Saving the PDF file on to Application server************************
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = w_bin_filesize
FILENAME = w_FULL_PATH
FILETYPE = 'BIN'
* APPEND = ' '
* WRITE_FIELD_SEPARATOR = ' '
* 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 = ' '
IMPORTING
FILELENGTH = w_filesize
TABLES
DATA_TAB = t_pdf_tab
* 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
As u said ,u want to download a smartform to Excel it could be done but only if u r using a internal table and exactly printing line by line values in the smartform, But if u are performing calculation in between, using multiple internal table Work areas, structures, etc i.e if whole smartform is developed with many distributed windows , unfortunately it wont be possible to download a smartform to excel in such cases, because the whole output comes from multiple internal tables, calculations, etc all the data is not printed in a tabular manner so in such a case it would be just impossible to download the smartform to excel.
But we definitely have a workaround which could be done to download the data into excel.
you can develop a ALV report with a header and footer u can define the header and footer of the alv according to the smartform and the middle portion would contain the tabular kind of data which u must be using as Smartform table to print the same.
So if u have a similar kind of smartform with some header data, tabular data, and some footer data, then u can use ALV to do the same thing , advantage with ALV would be that u can easily download the same into excel.
Other alternative is that u can Convert and download the smartform to PDF and copy the same to an Excel wooksheet.
These are all the possibilities with which u can do the same.
Regards,
Akash Rana -
How to export the result from executing sql statement to excel file ?
HI all,
Great with Oracle SQL Developer, but I have have a trouble as follwing :
I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
anyone can help me to do that ? Thanks so much
SigmasvnHello Sue,
I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
Regards
Marcus -
Q: XML Publisher build template on Word then Output to Excel file
Hi All
When create template on MS-Word then output to Excel file
When Data Format include percentage then output to Excel The Excel just only show two decimal
Ex: 9.6549% Excel show ->9.65%
* Except 9.6549% on Excel *
Thanks
JohnsonHi
What version of XML/BI Publisher you have?
Thanks
Ravi -
HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE
Hi SAP Gurus,
I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.You can transfer the contents of internal table to excel using this code..
data: begin of itab occurs 0,
vbeln like vbak-vbeln,
posnr like vbap-posnr,
end of itab.
select vbeln
posnr
from vbap
up to 20 rows
into table itab.
* EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
* handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_WORK TYPE OLE2_OBJECT,
H_SHEET TYPE OLE2_OBJECT,
H_CELL TYPE OLE2_OBJECT,
V_COL LIKE SY-TABIX. " column number of the cell
DATA:
V_STEP(30),
V_FILE LIKE RLGRAP-FILENAME.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Creating Excel...'
EXCEPTIONS
OTHERS = 1.
* start Excel
V_STEP = 'Starting Excel'.
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
* CALL METHOD OF H_EXCEL 'OPEN' EXPORTING #1 = 'C:DMC_REC.XLS'.
* PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Adding Data to Excel...'
EXCEPTIONS
OTHERS = 1.
* Get the list of workbooks
V_STEP = 'Preaparing Excel'.
CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
PERFORM ERR_HDL.
** Add new workbook (create a file)
CALL METHOD OF H_WORK 'ADD'.
PERFORM ERR_HDL.
* Get the created worksheet
************************Sheet Number
CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
************************Sheet Number
PERFORM ERR_HDL.
* Activate (select) the first sheet
CALL METHOD OF H_SHEET 'ACTIVATE'.
PERFORM ERR_HDL.
* tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
* PERCENTAGE = 0
TEXT = 'Adding Data to Excel...'
EXCEPTIONS
OTHERS = 1.
* output column headings to active Excel sheet
V_STEP = 'Adding data to Excel'.
LOOP AT ITAB.
V_COL = SY-TABIX.
PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
ENDLOOP.
V_STEP = 'Releasing Excel'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
H_EXCEL-HANDLE = -1.
*& Form ERR_HDL
* text
* --> p1 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Error in processing Excel File:', V_STEP.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
*& Form FILL_CELL
* text
* -->P_1 text
* -->P_1 text
* -->P_1 text
FORM FILL_CELL USING ROW COL VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_CELL
EXPORTING #1 = ROW #2 = COL.
PERFORM ERR_HDL.
SET PROPERTY OF H_CELL 'Value' = VAL .
PERFORM ERR_HDL.
ENDFORM. " FILL_CELL -
Hi;
From sqlplus, I can write the output of the sql query to csv file.
What I want to do is,
Suppose my excel file which consist of two seperate sheets.
When I execute query1 it should write the output to sheet1.
When I execute query2 it should write the output to sheet2.
How can I do that? Any suggestion?You might want to look at the ExcelDocumentType and ExcelDocTypeUtils here: http://www.jasonsdevelopercorner.com/?page_id=8
The ExcelDocumentType is an Oracle User Defined Type (UDT) that allows a developer to generate fully functional Microsoft Excel Spreadsheets using PL/SQL directly from the database. The spreadsheets will be encoded as Microsoft Excel 2003 XML Spreadsheets. Microsoft Excel will recognize the files with both a .xml or .xls extension (Excel 2007 will ask user for permission to open the file if the .xls extension is used …). The ExcelDocumentType supports the following Excel features:
* Creation of multiple worksheets
* Custom Header and Footer
* Creation of custom Excel styles (color, font, number formats, text rotation, etc.)
* Creation and application of formulas
* Worksheet titles (expanded cell)
* Worksheet naming (sheet tabs)
* Creation and application of worksheet level conditional formatting.
* Creation of hyper-linked cells (Sheet to sheet, external links, or email links).
* Custom cell attributes (in case you want to apply one that isn’t already provided).
The ExcelDocumentType provides three direct methods of document retrieval/delivery:
* The document can retrieved as a CLOB.
* The document can be streamed directly to a web browser through a PL/SQL DAD (if delivering content to the browser using PL/SQL).
* The document can be retrieved in a PL/SQL table via a user defined type called ExcelDocumentLine
The code packaged with the ExcelDocumentType includes a PL/SQL Package (API) called ExcelDocTypeUtils that makes the creation of a spreadsheet very simple.
People have been using this for several years with very good results.
Jason Bennett -
Error while running the SSIS package from SQL DB to excel file - export option
hi all,
I have 4.6 million records in my sql db and i want to copy this into a excel file. for this i went to the db and rt click and export to command and started the ssis package running. but after
few minutes, it throws me an error that "error in transferring data into excel file."
Can anyone help me why this happened and the resolution ?
help is appreciated!
Copying to `excel1_Wbook` (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x8007000E.
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - excel1_Wbook" (217) failed with error code 0xC0202009 while processing input "Destination Input" (228).
The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information
about the failure.
(SQL Server Import and Export Wizard)
Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
(SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - excel1_Wbook returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The
meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)You need to split your data and create (at least 5) worksheet targets.
For example if you have a ROW_NUMBER column you can use for instance a
Conditional Split for something like:
ROW_NUMBER % 5 == 0 for Case 1 (excel 1)
ROW_NUMBER % 5 == 1 for Case 2 (excel 2)
ROW_NUMBER % 5 == 2 for Case 3 (excel 3)
ROW_NUMBER % 5 == 3 for Case 4 (excel 4)
ROW_NUMBER % 5 == 4 for Case 5 (excel 5) -
How to export the sql output to Excel?
I installed Raptor on my system. I ran few reports and trying to figure out how to save the reprots to excel srpeasheet format. I just see 'save' but not sure where the output is saved and with what filename. Saveas is grayed out all the time.
Unfortunately, there are some things that Excel gets confused going through CSV files (or copy and pate). For example, our task number structure within Oracle Projects is to name each task with the super-task number "-" sub task number (10, 10-1, 10-2, 10-3, etc). As soon as you are not directly creating the Excel file, Excel will interpret the "10-1", "10-2", etc as dates - 10-Jan, 10-Feb for our date format and presumably 1-Oct, 2-Oct for US date format.
I have just tested exporting the data to CSV and then opening in Excel and also selecting all data, copying and pasting into Excel and both convert "10-1" to 10-Jan (assumes current year).
You get similar issues with text columns that contain only numeric values (for example our employee numbers are stored in a text field, but are numeric and left passed with zeros to ensure consistent length), or a mixture of numeric values and alpha-numeric values. -
Problem while downloading the alv output to excel file.
Hii,
While downloading the alv output to an excel file i am facing a problem. Either the output comes as 1.23456E+11 or the values get cut .
Cant put in txt file as the users require to calculate directy and i have even tried to increase the output length .But both doesnt help.
So what are the other ways to do so.
Edited by: mansi_v27 on Mar 24, 2010 12:35 PMHi,
Welcome to SCN!!!.
Please go through the forum rules. This has been discussed many times. You can search in the forum for this.
Infact there is no problem. Just expand that excel cell. You can see the full value. This is standard excel property.
Thanks,
Vinod. -
Regarding ALV output to Excel file download
Hi all,
i had a requirement when downloading the ALV output to the Excel file it should ask for the password.if the user enters the password then this pass word shuld be assigned to the Excel file that was downloaded.
Can i know how this can be implementedHi,
Using EXCEL_OLE_STANDARD_DAT you can specify the PASSWORD & PASSWORD OPTION.
Regards,
Sharat -
Save ALV report output as excel file in background
Hi all,
As the no. of records is huge and the running time is long, I'd like to modify my program to be able to run in background mode with excel as output..
Is there any method to generate the result list in ALV format and save it as an excel file while running the program in background mode?
And any limitation?
Thanks!Try to create ALV output to spool in background then try to use any of the below mentioned fm
SAP_CONVERT_TO_XLS_FORMAT
MS_EXCEL_OLE_STANDARD_DAT
RSPO_DOWNLOAD_SPOOLJOB
RH_START_EXCEL_WITH_DATA
or
create CSV using OPEN DATASET & TRANSFER
a® -
Convert report output into excel file
hiii,
Can we convert output of report into excel file format?
Plz tell me the.
Thanks in advanceHello,
http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_paptoexcel.htm
29 Building a Report for Spreadsheet Output
Regards -
Regarding ME2L - Download output to Excel File
Hi Friends,
In ME2L, I have requirement to download the Purchasing Documents Per Vendor Report Output to a Excel File.
Could be helpful is there any UserExit or Enhancement point to modified or Can let me know how to do this.
Regards,
sg.Hi,
Go to me2l tcode.....then change the "Scope of List" into "ALV".....and execute it.....now on the tool bar...click on "LOCAL FILE"....now select the radio button "Spreadsheet".....and perform your work..
Arunima
Maybe you are looking for
-
How to resolve Message "Incorrect translation in error saving docuemnt message"?
As of 29/Jan/2014, I only get this message from Adobe Reader of iPad (Japanese environment) Regardless of my subscription, I cannot convert anything to PDF. How to resolve or get money back?
-
I Have been using FF but now it won't open.
I can no longer open Firefox. I have tried the following solutions with no luck: I tried to uninstall Firefox so I can reinstall FF and I got this message: "FF must be closed to proceed with the uninstall" "Please close FF to continue" I tried to dow
-
How to create CT_TOMBSTONE table
In Cus Case ct_tombstone table has been delete some how. I verified logging in to ods chema and try to run desc for ct_tombstone table SQL> show user USER is "ODS" SQL> desc ct_tombstone ERROR: ORA-04043: object ct_tombstone does not exist Now Cus ha
-
Cancel Work process using SM50 fails
When I ran a custom program while developing and system was hung. So I did CNTR ALT DEL. After that tried to cancel a work process using SM50 cancel without core, cancel with core, end session, end session using SM04 etc. I am getting a message "&An
-
How can I fix the year on my iPad ., How can I fix the year on my iPad .
The year on my iPad says 2557 b.e. .... How do I make it 2014?