cancel
Showing results for 
Search instead for 
Did you mean: 

Export to Excel Prob.

Former Member
0 Kudos

Hi....

i have created a WDProject to export the data of the table to excel using the steps given in this link:

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/edc2f3c2-0401-0010-8898-acd5b6a94353]

1.when i select the link2URL UI i get three options:

According to the above link, "as XML List" is to be selected.

But when i select this option, MS-Excel opens but with no sheet opened in it.

2. So i select the next option i.e. "as a read only workbook".With this the sheet opens, but in an internet explorer. Here, the headings contain slashes in between. The columns that are of type integer are displayed twice. Moreover, the user cannot save the sheet also.

Plz provide the solution to this as soon as possible. ITS URGENT...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Ruchi,

Are you sure that you are getting the right string from toexcel method. Try to print the string that you getting from there. When you try to open the Excel sheet, it has to open using the first option. i believe, it could be with the XML parsing.

Check that out

Regards

Vinod V

Former Member
0 Kudos

Hi Ruchi,

there seems to be a problem with ur MS Office version. Are u sure u r using MS 2003 only?

Why dont u try out this blog: /people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities

its an awesome blog and many other things also can be done by using the blog. Plus, you can edit the java file this blog talks about, to implement other java functionalities as well.

Have a look at this blog.

Regards,

Gita

Former Member
0 Kudos

hi Gita,

There was a problem in MS-Excel 2003

Thanks

Former Member
0 Kudos

Hi,

I am trying to implement this Total and Excel in my application, total is working fine, importing to excel is casuing lot of errors.

Can you please exlain, how to export my table data to Excel?.

Where should I keep the following code in my resultView?. What are the contexts elements & other things do i need to create for this?.

Creating an Excel File

For downloading a table to excel 2003,

Map m = wdContext.currentContextElement().getTableutility().DownloadToExcel(columninfos);

Column infos is a arraylist of column names.

ArrayList al = new ArrayList();

al.add(IPrivateSDNUtilityView.IDepartmentsElement.DEPARTMENTNAME);

al.add(IPrivateSDNUtilityView.IDepartmentsElement.NO_OF_PEOPLE);

This returns a map which has the following

“data” ,”url” , “error”.

“data” returns the binary data which can be mapped to a filedownload ui element.

“url” gives a url from which you can access the excel file. “error” returns error if any.

Thus we can create a link to Url element(“url”) or a filedownload element (“data”)and map it to this value to get the excel file directly.

Ex :

wdContext.currentContextElement().setExcelfile((String)wdContext.currentContextElement().getTableutility().DownloadToExcel(al).get("url"));

Former Member
0 Kudos

Hi,

u put ur columns info in begin other part. And last two line in doInit method.

For export to excel u hv to create one utility file. Create a file with name “TableUtilities.java” and paste the code provided at the end of weblog [https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3596] [original link is broken] [original link is broken] [original link is broken];. Save the file and paste in some folder in src/packages.

In packages create one folder bh and put “TableUtilities.java” in "bh".

U need to create only one Context Element that is Excelfile of type String.

Former Member
0 Kudos

I have already created the Java class, calculating sum is working fine. For export to Excel I have created context element(Excelfile) and LinkToURL(url).

If there is any mistake, can you please correct this code,....

public void wdDoInit()

{

//@@begin wdDoInit()

ArrayList al = new ArrayList();

al.add(IPrivateResults.ISalesOrdersElement.MATERIAL);

al.add(IPrivateResults.ISalesOrdersElement.REQ__QTY);

wdContext.currentContextElement().setExcelfile((String)wdContext.currentContextElement().getTableutility().DownloadToExcel(al).get("url"));

//@@end

}

I am getting follwoing error...

-


java.lang.NullPointerException

at .sd.salesorderslist.Results.wdDoInit(Results.java:106)

at .sd.salesorderslist.wdp.InternalResults.wdDoInit(InternalResults.java:171)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)

-


Former Member
0 Kudos

Hi Jai,

Use Try and Catch block...... See If you can find something.

Regards

Avik

Former Member
0 Kudos

Hi All,

Firstof I want to open a blank XLS file.

For that Do I need to put any properties in URLtoLink UI lelement?.

Please advice.

Former Member
0 Kudos

What do you mean by blank Excel file Jai?

Former Member
0 Kudos

I mean blank is without data in excel....

Have you implemented this?. If you know something please share...