Report data download to excel file
Hi experts,
My requirement is report data download to excel file and that file should be an attachment to send email to specified people.
first i want to to download data to excel file and that file should be an attachment.
Regards
V.Venu
Hi venu,
Before posting the question, just search for the related query, more number of post has been posted related to your query,
any ways check this below links, it will solve your problem.
<<linkfarm removed>>
Cheers
NZAB
Edited by: kishan P on Jan 10, 2012 4:51 PM
Similar Messages
-
APEX Report Data Download in Excel and PDF format
Hi,
Can someone please guide me how to download APEX report data in Excel and PDF format.I know this is possible through BI Publisher but that is extra Licence cost for client so i don't want to use that option.
Thanks in advance.
Regards
Prabhat Mishra1005844 wrote:
Hi ,
Thanks for Reply,
I am using APEX 4.2 but when i am trying to download the IR data then getting 3 options only(CSV,HTML and Email).
PrabhatWell, Excel should understand the .csv format for offloads. Perform web seraches to see what can be done for pdfs -
Downloading into excel file , the is alignment is out
The reports when downloading into excel file is not what we usually getting. The alignment is out.
Hi Basavaraj,
When you are creating dynamic internal table(itab1) and fields of internal table, at the same time in the same way create one more internal table(itab2) resrict this up to 10 columns.
now
DATA : num type i,
FNAME(255) TYPE C
VALUE '/data/sapdata/filename'.
CONSTANTS : C_COMMA TYPE C VALUE ','.
DATA : BEGIN OF I_DISPLAY OCCURS 0,
REC(400),
END OF I_DISPLAY.
loop at itab1
num = num + 1.
if num le 100.
move-corresponding fields to itab2
else.
exit.
endif.
endloop.
Give column headings
itab2-col1 = 'name1'
itab2-col2 = 'name2'
itab2-col3 = 'name3'
itab2-col4 = 'name4'
itab2-col5 = 'name5'
itab2-col6 = 'name6'
itab2-col7 = 'name7'
itab2-col8 = 'name8'
itab2-col9 = 'name9'
itab2-col10 = 'name10'
INSERT itab2 INDEX 1.
CLEAR itab2.
loop itab2.
CONCATENATE
itab2-col1
itab2-col2
itab2-col3
itab2-col4
itab2-col5
itab2-col6
itab2-col7
itab2-col8
itab2-col9
itab2-col10
into I_DISPLAY-REC SEPARATED BY C_COMMA.
APPEND I_DISPLAY.
CLEAR I_DISPLAY.
ENDLOOP.
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.
LOOP AT I_DISPLAY.
TRANSFER I_DISPLAY TO FNAME.
ENDLOOP.
CLOSE DATASET FNAME.
endloop. -
Introduction
There is a scenario that a report grouped by one field for some reasons, then the users want to export each group data to separated Excel files. By default, we can directly export only one file at a time on report server. Is there a way that we can split
the report based on the group, then export each report to Excel file?
Solution
To achieve this requirement, we can add a parameter with the group values to filter the report based on the group, then create a data-driven subscription for the report which get File name and parameter from the group values.
In the report, create a parameter named Name which use the Name field as Available Values (supposing the group grouped on Name field).
Add a filter as below in the corresponding tablix:
Expression: [Name]
Operator: =
Value: [@Name]
Deploy the report. Then create a data-driven subscription with Windows File Share delivery extension for the report in Report Manager.
During the data-driven subscription, in the step 3, specify a query that returns the Name field with the values as the group in the report.
In the step 4 (Specify delivery extension settings for Report Server FileShare), below “File name”option, select “Get the value from the database”, then select Name field.
Below ‘Render Format’ option, select Excel as the static value.
In the step 5, we can configure parameter Name “Get the value from the database”, then select Name field.
Then specify the subscription execute only one time.
References:
Create a Data-Driven Subscription
Windows File Share Delivery in Reporting Services
Applies to
Reporting Services 2005
Reporting Services 2008
Reporting Services 2008 R2
Reporting Services 2012
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.Thanks,
Is this a supported scenario, or does it use unsupported features?
For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
in a supported way?
Thanks! Josh -
Downloading report o/p to excel file
Hi experts,
I have developed a report in abap. I want to add a functionality in the output display of the report giving user an option to download in excel file. what functions do i need to call? Someone plz help. <b><REMOVED BY MODERATOR></b>
Thanks
Message was edited by:
Alvaro Tejada GalindoHello,
you can use the FM:
GUI_DOWNLOAD
If you want to use the OOP concept, than you can use
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
regards,
Naimesh Patel -
Download an excel file in background mode
Hi All,
I need to download a file from a ABAP report to the local workstation in background mode. I tried GUI_DOWNLOAD but it is failing in the background.
Is there any way to download the excel file in the background. I am thinking of generating the spool.
Please let me know if anybody has worked on the same requirement. Any help would be highly appreciated.
Thanks a lot.
Regards,
PritiYou be able to use the function "WS_DONLOAD" ?
parameters: p_fnam like rlgrap-filename memory id fnam obligatory.
data: begin of t_registro occurs 0,
registro(1000),
end of t_registro.
describe table t_registro lines sy-tfill.
if sy-tfill gt 0.
l_tam = strlen( p_fnam ).
call function 'WS_DOWNLOAD'
exporting
filename = p_fnam
tables
data_tab = t_registro
exceptions
file_open_error
file_write_error
invalid_filesize
invalid_type
no_batch
unknown_error
invalid_table_width
gui_refuse_filetransfer
customer_error.
if sy-subrc <> 0.
open dataset p_fnam for output in text mode.
if sy-subrc = 0.
loop at t_registro.
transfer t_registro to p_fnam.
endloop.
close dataset p_fnam.
write:/ 'Se genero el archivo:', p_fnam(l_tam).
else.
write:/ 'No se pudo generar el archivo:', p_fnam(l_tam).
endif.
close dataset p_fnam.
else.
write:/ 'Se genero el archivo:', p_fnam(l_tam).
endif.
endif.
I hope this works for you.
See ya.
Ar@ -
Bring Color to Column Headings of downloaded ms-excel file
Hi,
Iam downloading report output to MS-Excel sheet using MS_EXCEL_OLE_STANDARD_DAT ...but what i want is how can i bring specific color to column heading of that downloaded Ms-excel file..using ole u can do it ...
<b>just copy nad paste this example...</b>&----
*& Report ZNEGI17 *
REPORT ZNEGI17 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_CELL1 USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL1 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_CELL1 USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL1 USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL1 USING 1 3 1 'Von'(003).
PERFORM FILL_CELL1 USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL1 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_CELL1 USING I J BOLD VAL.
data : color(5) type x value 'H80000008'.
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.
SET PROPERTY OF H_F 'ColorIndex' = 3 .
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
*& Form FILL_CELL1
text
-->P_H text
-->P_1 text
-->P_0 text
-->P_IT_SPFLI_CARRID text
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.
endform. " FILL_CELL1 -
Warning while downloading an Excel file from WD ABAP
Hi folks,
In one of requirements, Client wants to download all the data that is appearing on the screen ( WD ABAP Application ) to an Excel with a layout in different manner.
We achieved this with Simple Transformations.
Now the question is while downloading the excel file, the framework/other is throwing an Warning like
" The file you are trying to open, 'info.xls', is in a different format than specified by the extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now? "
Note: All the users of my client are using MS Office 2002 / 2003.
I am using the following code........!
*------ Call Transformation for Excel OUTPUT
CALL TRANSFORMATION ZEXCEL_OUTPUT
SOURCE
t_dates = t_dates
t_info = t_info
RESULT XML l_xml_string.
REPLACE ALL OCCURRENCES OF '<?xml version="1.0" encoding="utf-16"?>' l_xml_string WITH '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>'.
**-- Call Function Module for converting string data to XSTRING
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = l_xml_string
mimetype = 'application/xml'
IMPORTING
buffer = l_xml_xstring
EXCEPTIONS
failed = 1
OTHERS = 2.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'info.xml'
i_content = l_xml_xstring
i_mime_type = 'application/vnd.ms-excel'.
With this code I am generating a file of type XML SPREADSHEET 2003. While opening this file I am getting the above message which the user unwanted......
Can any one help me on this -
> How to avoid this warning?
Thanks and Regards,
Aneel Danda
Edited by: danda aneel on Jul 13, 2010 1:43 PMFirstly, Thanks for Your quick Response, Thomas.
Even though what ever may be the file name I am passing either info.xml or Info.xls , In error info.xls is coming.
Kindly provide me an alternative on this XML doesn't seem like it would match the 'application/vnd.ms-excel'.
what is the supported format.?
Similarly, It is not considering the UTF-8 / UTF-16 for xml.........same result is appearing in the output.
Edited by: danda aneel on Jul 14, 2010 7:52 AM -
GUI_UPLOAD to read data from an Excel File
Hi Folks,
I'm using FM GUI_UPLOAD to read data from an Excel File. But all I see in the table returned is 1 row with garbage values (special chacaters). Excel Workbook has proper data in the sheet, but its not getting uploaded properly. Sy-subrc is 0.
What could be the reason?
Thanksuse FM : ALSM_EXCEL_TO_INTERNAL_TABLE
See the example program to get from XLS file to Internal table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data -
I would like to create a workflow in Automator or a script in AppleScript (or a combination of the two), that opens Safari to a specified page and downloads an excel file from this page and saves the downloaded document to my desktop.
Is this something that be done? If so, how?
I have so far been able to build a workflow in Automator to open Safari and added an AppleScript that takes Safari to a specific page that has an Excel document.
I can't figure out where to go from here... Any help would be apprecitated.
Thanks!Would you have the web address the excel sheet is on?
Is there a simular web page you could point to if not?
Would there be a copy of the file on an FTP page. This would be easier.
curl
http://www.cyberciti.biz/faq/mac-os-x-terminal-download-file/
http://www.thegeekstuff.com/2012/04/curl-examples/
http://curl.haxx.se/docs/manpage.html
Macintosh-HD -> Applications -> Utilities -> Terminal
# Press return to run a command.
the curl is a terminal command ( Unix ). It allows you to read a file off of the web.
man curl
provides cryptic information on the commnad curl.
press the space bar to advance a page.
press letter to q to quit.
What you may have to is to read in the web page as a text file. Go "fishing" through the page to find the excel file you need. Once you find the file, you can use curl to read the file.
curl is a very full featured command. (read complex to figure out ).
It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on. Here is an example.
Author: rccharles
For testing, run in the Script Editor.
1) Click on the Event Log tab to see the output from the log statement
2) Click on Run
For running shell commands see:
http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
on run
-- Write a message into the event log.
log " --- Starting on " & ((current date) as string) & " --- "
-- debug lines
set desktopPath to (path to desktop) as string
log "desktopPath = " & desktopPath
set unixDesktopPath to POSIX path of desktopPath
log "unixDesktopPath = " & unixDesktopPath
set quotedUnixDesktopPath to quoted form of unixDesktopPath
log "quoted form is " & quotedUnixDesktopPath
try
set fromUnix to do shell script "ls -l " & quotedUnixDesktopPath
display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
on error errMsg
log "ls -l error..." & errMsg
end try
end run -
Help! Check data in MS Excel file(JDBC-ODBC)
Hi guys,
I wrote a program that can check data in MS Excel file.
User can input a sentence like "1->2" ,"1->3" (one determine one), then the program can find the data which violate the integrity constrains(functional dependency).For example, if we have the functional dependency "TSeq_gi->TSeq_accver", the program looks for two or more tuples with the same "TSeq_gi" value but the different "TSeq_accver" value in Excel file. These tuples violate the integrity constraint. But now,I can't figure out how to modify this program to multiple determine one. (like 1 3->5 or 1 3 4 5->7) . 1 3 ->5 means: look for 1 and 3 have same value but 5 different. I get stuck. Can some experts help me?
The code and Excel file are in below link. Download and play it! Thank you~~
Karen.
http://us.f1f.yahoofs.com/bc/665bbb4/bc/Java/code.zip?bf6cljAB_wgRYVQf
PS: You need to set up JDBC ODBC driver in MS windows "Administrative Tools" first. Data Souce name is Test .
Main logic class:
class MyActionListener implements ActionListener{
public void actionPerformed(ActionEvent e){
if (e.getActionCommand()=="SEARCH")
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con1= DriverManager.getConnection("jdbc:odbc:Test");
stmt2= con1.createStatement();
input1 = new String(pathTf.getText());
main_loop: while(true){
if (input1.equals("0")){
// break out of while(1)
break main_loop;
st= new StringTokenizer(input1," ,-=>");
while(st.hasMoreTokens()){
// analyze the input stream.
// Attention, the program didn't do the input value check.
input1= st.nextToken();
input2= st.nextToken();
query= "select "+ schema[Integer.parseInt(input1)-1]+ ","+ schema[Integer.parseInt(input2)-1]+ " from [Sheet1$]";
rs2= stmt2.executeQuery(query);
rowCounter= 0;
list1.clear();
list2.clear();
list3.clear();
while(rs2.next()){
// increase the row counter
rowCounter++;
// initial the flag
col1= rs2.getString(1);
col2= rs2.getString(2);
// for the initalization
if (list1.isEmpty()){
list1.addElement(col1);
list2.addElement(col2);
row="Row 2";
list3.addElement(row);
// compare weather exist dependance
else
for (int i=0;i<list1.size();i++){
// if col1 match with the first part of value in the list
if (((String)list1.get(i)).equals(col1)){
// The independence pair match
if (((String)list2.get(i)).equals(col2)){
break;
else
textArea.append("\n"+"Violate Integrity Constraints Found : "+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");
System.out.println("\n"+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");
break;
// if col1 not match with any value, add a new record in list
else
list1.addElement(col1);
list2.addElement(col2);
row="Row "+ (rowCounter+1);
list3.addElement(row);
}// end of for
}//end of else
}//end of while
}//end of while(1): main_loop
}catch(Exception ex){
//System.err.println(ex);sorry~~I am new here!
class MyActionListener implements ActionListener{
public void actionPerformed(ActionEvent e){
if (e.getActionCommand()=="SEARCH")
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con1= DriverManager.getConnection("jdbc:odbc:Test");
stmt2= con1.createStatement();
input1 = new String(pathTf.getText());
main_loop: while(true){
if (input1.equals("0")){
// break out of while(1)
break main_loop;
st= new StringTokenizer(input1," ,-=>");
while(st.hasMoreTokens()){
// analyze the input stream.
input1= st.nextToken();
input2= st.nextToken();
query= "select "+ schema[Integer.parseInt(input1)-1]+ ","+ schema[Integer.parseInt(input2)-1]+ " from [Sheet1$]";
rs2= stmt2.executeQuery(query);
rowCounter= 0;
list1.clear();
list2.clear();
list3.clear();
while(rs2.next()){
// increase the row counter
rowCounter++;
// initial the flag
col1= rs2.getString(1);
col2= rs2.getString(2);
// for the initalization
if (list1.isEmpty()){
list1.addElement(col1);
list2.addElement(col2);
row="Row 2";
list3.addElement(row);
// compare weather exist dependance
else
for (int i=0;i<list1.size();i++){
// if col1 match with the first part of value in the list
if (((String)list1.get(i)).equals(col1)){
// The independence pair match
if (((String)list2.get(i)).equals(col2)){
break;
else
textArea.append("\n"+"Violate Integrity Constraints Found : "+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");
System.out.println("\n"+" Row "+ (rowCounter+1)+ " not match with "+ list3.get(i)+".");
break;
// if col1 not match with any value, add a new record in list
else
list1.addElement(col1);
list2.addElement(col2);
row="Row "+ (rowCounter+1);
list3.addElement(row);
}// end of for
}//end of else
}//end of while
}//end of while(1): main_loop
}catch(Exception ex){
//System.err.println(ex);
} -
How to retrieve data from an Excel file which is located on server
hi everybody,
I am using SAP NWDS 2004s .
I have done an application on how to export the table data into an Excel .
Now i want to get the data from an Excel file which is located in server and display that data which is in excel in a View for example a Sample view in Webdynpro .
In Sample view i took a uielement textview to display the data ....
can any one help how to procced further
Thanks in advance
MadhaviOptions to read Excel data to WebDynpro context
Reading Excel Sheet from Java without using any Framework
Reading Multiple Sheets of Excel Sheet from Java
Few Threads
How to Display the content of Excel file into Webdynpro Table
Is it possible to upload data from excel file(.xls)
Re: How to export the data as integer into excel sheet?
regards
Vinod -
Reading data from an excel file
Hi,
I want to read data from the excel file and display it in
jsp page. Iam getting the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:mydsn","","");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from [holidays$]");
Here i have created the dsn with the name "mydsn". I have the
following data in the mydsn.dsn file:
[ODBC]
DRIVER=Microsoft Excel Driver (*.xls)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
ReadOnly=1
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=excel 8.0
DriverId=790
DefaultDir=D:\WorkSpace\Projects\VINET\devl\webroot\jsp
DBQ=D:\WorkSpace\Projects\VINET\devl\webroot\jsp\list_of_holidays_2003.xls
thanks in advance
phani.You might want to look at the POI project (an open source Jakarta sub-project) that allows you to create/modify/read excel files via Java code. That might be more flexible and easier than what you're currently trying to do.
Cheers -
How to export the data from an excel file to Oracle database by using macro
Hi,
I want to export data from an excel file into Oracle database.There is one method that by creating the macros through excel we are able to do this.
can anybody please send me the code to create macros?
Thanks in advance.
Regards,
Surendra.VThere are several resources on the web, but you could start analyzing if this code fits your needs --> VBA Macro for Excel 2003 Export of Text File with Comma and Quote Delimiters.
~ Madrid -
How to read data from the excel file using java code.
Hi to all,
I am using below code to getting the data from the excel file but I can't get the corresponding data from the specific file. can anyone give me the correct code to do that... I will waiting for your usefull reply......
advance thanks....
import java.io.*;
import java.sql.*;
public class sample{
public static void main(String[] args){
Connection connection = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbc:odbc:Mydsn","","" );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );
System.out.println("sample:"+rs);
ResultSetMetaData rsmd = rs.getMetaData();
System.out.println("samplersd:"+rsmd);
int numberOfColumns = rsmd.getColumnCount();
System.out.println("numberOfColumns:"+numberOfColumns);
while (rs.next()) {
System.out.println("sample1:"+rs);
for (int i = 1; i <= numberOfColumns; i++) {
if (i > 1) System.out.print(", ");
String columnValue = rs.getString(i);
System.out.print(columnValue);
System.out.println("");
st.close();
con.close();
} catch(Exception ex) {
System.err.print("Exception: ");
System.err.println(ex.getMessage());
}1: What is the name of the excel sheet?
2: What is printed in this program? null ? anything?
error?Excel file name is "sample.xls" I set excel file connectivity in my JDBC driver(DSN). Here in my program I am not giving that excel file name. I am giving only that excel sheet name. that is followed
ResultSet rs = st.executeQuery( "Select * from [Sheet1$]" );The output of this program is given bellow.
sample:sun.jdbc.odbc.JdbcOdbcResultSet@1b67f74
samplersd:sun.jdbc.odbc.JdbcOdbcResultSetMetaData@530daa
numberOfColumns:2
Maybe you are looking for
-
How do I access someone for technical support? what telephone number can I use?
-
Get the length of column for each row in 2d array
let say if i declared a 2d array int [][]set = new int[5][5]; if i had finished storing datas in the 2d array like the following Columns row 0[10][10][10][10][10] row 1[20][][][][] row 2[15][25][30][][] row 3[17][12][][][] row 4[10][][][][] how do we
-
Compiling... stdio.h not found :s
Right so I installed the developer tools. Wrote a very simple c prog and tried to compile it. Problem is that it doesn't find the standerd header files (stdio.h in my case). I did a find it's on my box. I set LDLIBRARYPATH to the driectory it's in...
-
Is there a way to delete mail listing associated with a Wiki page?
There seems to be no way to delete mailed in entries to a wiki page. In other words when I e-mail to a wiki mail list such as [email protected], the resulting entry can't be deleted. Is there a way to do this?
-
Adobe Air and iOS 7 microphone prompt issue
I have read numerous posts that the latest versions of Adobe Air 3.9 Beta is supposed to resolve the issue of iOS 7 apps prompting for microphone access. However, I am still encountering this error. Am using Adobe AIR: v3.9 Beta Adobe Flash CC: v13.0