How to save excel report as CSV file with ActiveX
Hi,
I'm trying to save my excel test report as a CSV file using ActiveX and I'm having difficulty getting started. I can't find an invoke node method that enables CSV file conversion.
Can anyone shed light on this? See attached screenshot.
Thanks
As long as you are using the Report Generation Toolkit, there is no need to use ActiveX for the purpose of saving the Excel file -- Save Report will do that for you. You can then export (as text) all of the Excel data and use the Write Spreadsheet File to make the .CSV file. Here is how I would rewrite the final bits of your code --
I cleaned up the wires around Excel Easy Table a bit. You'll see I made a VI Icon for Replace Filename, which does (I think) a nicer job of self-documenting than showing its Label. To make the filename, add the correct extension (.xlsx for Excel, .csv for CSV), use Build Path to combine Folder and Filename, and wire to Save Report.
The next two functions add the Extract Everything and Write to Spreadsheet, using a Comma as a separator, which makes a CSV copy for you.
Bob Schor
Similar Messages
-
How to save and open Text/csv file over APS
Hi,
I want to save(and open later) data from database block in text/csv file format over Application server, I did a lot of search here on Forms but didn't found a reasonable solution, Some one plz help me.
Thanks and Regards, Khawar.As long as you are using the Report Generation Toolkit, there is no need to use ActiveX for the purpose of saving the Excel file -- Save Report will do that for you. You can then export (as text) all of the Excel data and use the Write Spreadsheet File to make the .CSV file. Here is how I would rewrite the final bits of your code --
I cleaned up the wires around Excel Easy Table a bit. You'll see I made a VI Icon for Replace Filename, which does (I think) a nicer job of self-documenting than showing its Label. To make the filename, add the correct extension (.xlsx for Excel, .csv for CSV), use Build Path to combine Folder and Filename, and wire to Save Report.
The next two functions add the Extract Everything and Write to Spreadsheet, using a Comma as a separator, which makes a CSV copy for you.
Bob Schor -
How automatically save excel report?
Dear sir,
I am generated excel report using labview,
Present my doubt is how to Save Automatically that report in specified directory....?
Please Inform me,
Thank you...
Solved!
Go to Solution.Please replay this question
How to export wave form data in excel with specified location,
i.e.. Specified column,
How it is possible?
Thank you. -
How to save classical report as pdf file
hi all,
i have created a classical report and now the requirement is to save that report as a pdf .
is there any FM or any other method to do so?
regards
vijayHi Vijay,
Here is what I did for the same requirement:
Calling for the PDF File name and path to save the file
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = 'Quote Bom PDF File'
default_file_name = l_file_name
initial_directory = l_fullpath
prompt_on_overwrite = 'X'
CHANGING
filename = l_file
path = l_path
fullpath = g_path
user_action = l_user
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.
IF l_user = 0.
Please follow the following order for the subroutines which is creating the Spool Number, writing the*
statements on to the screen and then create the PDF file*
PERFORM get_spool_created.
PERFORM write_lines.
NEW-PAGE PRINT OFF.
g_spool_no = sy-spono.
PERFORM download_as_pdf.
Spool Number is getting created in this routine*
FORM get_spool_created .
DATA: pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
DATA: dest TYPE pri_params-pdest VALUE 'LP01'.
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = dest
no_dialog = 'X'
immediately = ' '
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
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.
pripar-linsz = '132'.
pripar-paart = 'X_65_132'.
pripar-prdsn = 'LP01'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
no_dialog = 'X'
list_name = name
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
NEW-PAGE NO-TITLE NO-HEADING PRINT ON
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
ELSE.
WRITE:/ 'Unable to create spool'.
EXIT.
ENDIF.
ENDFORM. " GET_SPOOL_CREATED
Write all your statements in this routine*
*& Form WRITE_LINES
text
--> p1 text
<-- p2 text
FORM write_lines .
CALL THE ROUTINE WHICH WRITES ALL LINES TO THE SCREEN
ENDFORM. " WRITE_LINES
*Download the file as PDF
*& Form DOWNLOAD_AS_PDF
text
--> p1 text
<-- p2 text
FORM download_as_pdf .
DATA:
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname,
l_jobcount LIKE tbtcjob-jobcount,
i_pdf TYPE TABLE OF tline,
i_cpdf TYPE TABLE OF tline,
l_spono TYPE tsp01_sp0r-rqid_char,
l_fullpath TYPE string.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = g_spool_no
no_dialog = ' '
IMPORTING
pdf_bytecount = l_no_of_bytes
pdf_spoolid = l_pdf_spoolid
btc_jobname = l_jobname
btc_jobcount = l_jobcount
TABLES
pdf = i_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
l_spono = g_spool_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = l_spono.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = l_no_of_bytes
filename = g_path
filetype = 'BIN'
TABLES
data_tab = i_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
ENDFORM. " DOWNLOAD_AS_PDF
Thanks.
Respond if you need any more help. -
How to save WEBI report in CSV format on file system
Hi
I am trying to save a WEBI report from BO server in CSV format through java / BO SDK. Iam able to save report in html , pdf and xls format. Please provide a code snippet if available.
I know for pdf and xls we directly use doc, binary view and for html there is HTMLVIEW. But iam not able to save it using CSV OutputFormatType
thanksHi,
Just in case, I think that Shawn wanted to send the following link showing the different formats:
http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RE_SDK/resdk_dg_doc/doc/resdk_java_CustoWebI_dg/ewucw_053.html#1037054
Cheers -
How to download a report into CSV file format?.
Hello all,
I have a requirement like this.
I have one custom Report. I need to download this report output into CSV format. In the selection screen, i am giving the pathname where report output need to be saved. Please let me know how to do it..
Thanks in advance....
Regards
RaviTYPE-POOLS: truxs.
TYPES:
BEGIN OF ty_Line,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
END OF ty_Line.
ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY.
DATA: itab TYPE ty_Lines.
DATA: itab1 TYPE truxs_t_text_data.
SELECT
vbeln
posnr
UP TO 10 ROWS
FROM vbap
INTO TABLE itab.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = itab
CHANGING
i_tab_converted_data = itab1
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
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 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\TEMP\test.txt'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1.
I found this in the blogs ....reward if it helps -
How to save data series in a file with possibility to overwrite last line
How to manage write/overwrite data on selected lines in a file?
it depends what sort of datafile you have.
on a spreadsheet file you could read the whole file, overwrite or insert data and resave it. -
Apex 3.0: export a report as .csv file without any Enclosed By character?
In Apex "Report Attributes page/Report Export" is possible to define the Enclosed By field.
The default Enclosed By by characters are a double quotation marks (" ").
Is there a way to export the report as .csv file without any Enclosed By character?
Example line format:
a) using default Enclosed By
"value1";"value2";"value3"
b) using ('') as Enclosed By
'value1';'value2';'value3'
c) using blank space as Enclosed By
value1 ; value2 ; value
d) without any Enclosed By character
value1;value2;value3
What can we do in Apex to export a report as .csv file with the line format example d)?
Thanks for your help.Hi,
There is no Out of the box feature in Apex to achieve this functionality. But what you can do is write a page process to generate the CSV that you want.
For this what I will do is on the first page where you press the Button it will call a PL/SQL page process which actually generates the csv. You can keep the existing report only for display purposes. Find the below process which generate the csv that you require.
begin
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="filename.csv"');
-- Close the HTTP Header
owa_util.http_header_close;
htp.prn('columnHeader1,ColumnHeader2,ColumnHeader3'||chr(13));
-- Loop through all rows
for x in (
Select column1,column2,column3 from table;
loop
-- Print out a portion of a row,
-- separated by commas and ended by a CR
htp.prn(x."column1"||','||x."column2"||','||x."column3"||chr(13));
end loop;
-- Send an error code so that the
-- rest of the HTML does not render
htmldb_application.g_unrecoverable_error := true; --You can leave out this line if you still want to display the existing HTML report.
end;
This will show a download box, so you can download the csv file. The page process should be called before header and the condition should be the button press. -
How export to csv work in safari browser?
In my application export to csv open like a raw data in new tab.
But other browsers working great!.
Need to open in a csv file or save it as a csv file.
Please suggest me. Thank you in advance!.Hi Adrian,
Why don't you try any another software for opening CSV files then Notepad ? According to my experience, you can use these softwares to open an CSV files and they are:-
Microsoft Excel
Open Office Calc
Google Docs
Also there is an additional tool available known as CSV viewer. You may try this, download it from here http://www.csvviewer.com/
I've never used Notepad for opening CSV files, because sometimes it contains some symbols which are not not at all compatibile with Notepad.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
How to export Bi Publisher report into .csv file in different sheets?
Hi,
I have a report request in BI Publisher to generate the results in different tabs in Excel format with headings etc.
But the users are now asking for the same report in .csv format with the same number of tabs in one file.
Can I do that in .csv file?
Regards
SailajaCan I do that in .csv file?
no
csv is simple plain-text
A comma-separated values (CSV) (also sometimes called character-separated values, because the separator character does not have to be a comma) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal comma or tab. Usually, all records have an identical sequence of fields.
Comma-separated values - Wikipedia, the free encyclopedia -
How to generate a second csv file with different report columns selected?
Hi. Everybody:
How to generate a second csv file with different report columns selected?
The first csv file is easy (report attributes -> report export -> enable CSV output Yes). However, our users demand 2 csv files with different report columns selected to meet their different needs.
(The users don't want to have one csv file with all report columns included. They just want to get whatever they need directly, no extra columns)
Thank you for any help!
MZHello,
I'm doing it usually. Typically example would be in the report only the column "FIRST_NAME" and "LAST_NAME" displayed whereas
in the csv exported with the UTL_FILE the complete address (street, housenumber, additions, zip, town, state ... ) is written, these things are needed e.g. the form letters.
You do not need another page, just an additional button named e.g. "export_to_csv" on your report page.
The csv export itself is handled from a plsql procedure "stored procedure" ( I like to have business logic outside of apex) which is invoked by pressing the button "export_to_csv". Of course the stored procedure can handle also parameters
An example code would be something like
PROCEDURE srn_brief_mitglieder (
p_start_mg_nr IN NUMBER,
p_ende_mg_nr IN NUMBER
AS
export_file UTL_FILE.FILE_TYPE;
l_line VARCHAR2(20000);
l_lfd NUMBER;
l_dateiname VARCHAR2(100);
l_datum VARCHAR2(20);
l_hilfe VARCHAR2(20);
CURSOR c1 IS
SELECT
MG_NR
,TO_CHAR(MG_BEITRITT,'dd.mm.yyyy') AS MG_BEITRITT ,TO_CHAR(MG_AUFNAHME,'dd.mm.yyyy') AS MG_AUFNAHME
,MG_ANREDE ,MG_TITEL ,MG_NACHNAME ,MG_VORNAME
,MG_STRASSE ,MG_HNR ,MG_ZUSATZ ,MG_PLZ ,MG_ORT
FROM MITGLIEDER
WHERE MG_NR >= p_start_mg_nr
AND MG_NR <= p_ende_mg_nr
--WHERE ROWNUM < 10
ORDER BY MG_NR;
BEGIN
SELECT TO_CHAR(SYSDATE, 'yyyy_mm_dd' ) INTO l_datum FROM DUAL;
SELECT TO_CHAR(SYSDATE, 'hh24miss' ) INTO l_hilfe FROM DUAL;
l_datum := l_datum||'_'||l_hilfe;
--DBMS_OUTPUT.PUT_LINE ( l_datum);
l_dateiname := 'SRNBRIEF_MITGLIEDER_'||l_datum||'.CSV';
--DBMS_OUTPUT.PUT_LINE ( l_dateiname);
export_file := UTL_FILE.FOPEN('EXPORTDIR', l_dateiname, 'W');
l_line := '';
--HEADER
l_line := '"NR"|"BEITRITT"|"AUFNAHME"|"ANREDE"|"TITEL"|"NACHNAME"|"VORNAME"';
l_line := l_line||'|"STRASSE"|"HNR"|"ZUSATZ"|"PLZ"|"ORT"';
UTL_FILE.PUT_LINE(export_file, l_line);
FOR rec IN c1
LOOP
l_line := '"'||rec.MG_NR||'"';
l_line := l_line||'|"'||rec.MG_BEITRITT||'"|"' ||rec.MG_AUFNAHME||'"';
l_line := l_line||'|"'||rec.MG_ANREDE||'"|"'||rec.MG_TITEL||'"|"'||rec.MG_NACHNAME||'"|"'||rec.MG_VORNAME||'"';
l_line := l_line||'|"'||rec.MG_STRASSE||'"|"'||rec.MG_HNR||'"|"'||rec.MG_ZUSATZ||'"|"'||rec.MG_PLZ||'"|"'||rec.MG_ORT||'"';
-- DBMS_OUTPUT.PUT_LINE (l_line);
-- in datei schreiben
UTL_FILE.PUT_LINE(export_file, l_line);
END LOOP;
UTL_FILE.FCLOSE(export_file);
END srn_brief_mitglieder;Edited by: wucis on Nov 6, 2011 9:09 AM -
IBots: Save report as CSV file on to a disk using iBot
Hi Experts,
The requirement is to configure an iBot, which saves a report as CSV flie at a give address on hard drive (eg: C:\iBots\files\my_report.csv). this file must be updated every week. thanks in advance for ur help,
SuryaSee this post:
http://oraclebizint.wordpress.com/2007/12/17/oracle-bi-ee-101332-calling-java-scripts-and-java-classes-from-ibots/ -
How to save the report file in network drive
Hi experts,
Can any one of you pls tell me how can save the report file in network drive.
My requirement:
by running a report i wll get daily data into a list.SO, i want to keep this in a common drive (network drive:Z) where every one can acces the txt file.
I want the code in SAP to design this.
Awaiting for an early reply.Is the Z drive in the application or presentation server ?
make sure the server has write access to the required folder
for presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\test_xls.xls'
filetype = 'ASC'
write_field_separator = 'X'
TABLES
data_tab = itab.
for the application server, use
data: outfile(120).
OPEN DATASET outfile FOR APPENDING IN TEXT MODE ENCODING DEFAULT. -
When Export ssrs Report to CSV file runtime filters not working
The Runtime Filters not working when Export SSRS Report to CSV format
Hi PatilPriti,
As for my understanding, the filter worked fine when you preview the report,
but it did not work when you export the report to CSV format. I tried to export the report to CSV file on my side, and the data was shown as expected. I guess the issue is due to the parameter or filter. please try to export to Excel format to test again
and make sure you created the filter correctly. Please refer to the following
blog about how to add a filter in SSRS:
http://arcanecode.com/2010/07/12/adding-filter-parameters-to-sql-server-2008-reporting-services-reports/
If the problem is not resolved, i would appreciate it if you could give us
detailed description of your problem.
It’s better to provide the table structure and some sample data, it will help us move more quickly toward a solution.
Thanks,
Wendy Fu -
I need to monitor a transducer block parameter and save it to a CSV file.
How can I monitor a transducer block parameter and save it to a CSV file? The reason is that I need to do some long-term testing of an FFb device we are developing, and I need to read the primary output parameter of the transducer block (not the scheduled AI block) every second or two and save to a CSV file.
I have tried to figure out a way to do that with FBUS Configurator, unsuccessfully, and I purchased FBUS Monitor, as that was recommended by an industry expert, but I have been unsuccessful at getting that to work as well.Hi Wpinson,
Neither FBUS Configurator nor Monitor can meet your requirement. However, there are other approaches. NI-FBUS provides APIs for C, LabVIEW, VB and C#. You can use these APIs to read a parameter value of any block and use standard file IO functions to save the date into CSV file. The LabVIEW APIs are highly recommended because they are easy-to-use and LabVIEW also provides APIs for CSV file operations. You can build the application w/ LabVIEW in a short time.
You can find the examples of the FBUS APIs in the following folders:
1. C: C:\Program Files\National Instruments\NI-FBUS\MS Visual C\examples
2. VB: C:\Program Files\National Instruments\NI-FBUS\MS Visual Basic\example
3. C#: C:\Program Files\National Instruments\NI-FBUS\MS .NET\examples\CsharpExample
4. LabVIEW: search "fieldbus" in the LabVIEW example finder.
Maybe you are looking for
-
How can I change the folder path to my library
I just changed the file path to my locally stored music from C:\MyStuff\...\iPod Nano Music\... to C:\OneDrive\...\iPod Nano Music\... Is there a way I can edit the path that Apple has locally stored to redirect iTunes to the new, correct location in
-
iphone 4 dropped in the pool..dead..contract up in sept. and will buy the new one. I went to ATTstore and was advised to get a pay as you go phone in the meantime, which I did, is there a way to transfer my contacts and itune music onto the new phone
-
No longer able to build ejb using appc (WLS 8.1)
I'm in the process of re-writing some build files to make use of the new appc compiler, but I started to get a rather confusing error. Although the EJB builds (using ejbc) and deploys fine on WLS 7, when I try to build using appc I get a slew of mess
-
Just got the 5. How can I make my old 4 usable as a touch?
The app store icon seems to have dissapeared since I converted to the 5.... but I would like to still use it like I would an Itouch.... is that possible?
-
Can Indesign CS3 be run legally on two machines
I have Photoshop CS3 and Indesign CS3. Photoshop can be installed on 2 machines (Desktop and laptop for traveling). It does not appear that I can do the same with Indesign (or am I doing something wrong). Thanks in advance, Bob