on 01-22-2010 7:48 AM
hi experts i have some problem am trying to export the data fro table to Excel sheet in the view controller i have created one button wit public void onActionCLEAR(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionCLEAR(ServerEvent)
//wdContext.nodeBapi_Salesorder_Getlist_Input().
//wdContext.nodeBapi_Salesorder_Getlist_Input().invalidate();
//@@end
}
//@@begin javadoc:onActionExporToExcel(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionExporToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionExporToExcel(ServerEvent)
try{
FileOutputStream fos=new FileOutputStream("Test.xls");
PrintStream ps=new PrintStream(fos);
ps.println("<html><body><table border=1>");
int size=wdContext.nodeBapi_Salesorder_Getlist_Input().size();
Iterator attributes=wdContext.getNodeInfo().iterateAttributes();
ps.println("<tr>");
while(attributes.hasNext()){
ps.println("<th>");
DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
ps.println(attrName.getName());
ps.println("</th>");
}
ps.println("</tr>");
for(int i=0; i<wdContext.nodeBapi_Salesorder_Getlist_Input().size();i++)
{
attributes=wdContext.getNodeInfo().iterateAttributes();
ps.println("<tr>");
IWDNodeElement ele=wdContext.getElementAt(i);
while(attributes.hasNext()){
ps.println("<td>");
DataAttributeInfo attrName=(DataAttributeInfo)attributes.next();
ps.println(""+ele.getAttributeAsText(attrName.getName()));
ps.println("</td>");
}
ps.println("</tr>");
}
ps.println("</table></body></html>");
ps.flush();
ps.close();
fos.close();
}
catch(Exception e){
wdComponentAPI.getMessageManager().reportException(e.getMessage(), false);
}
finally{
//return("Test.xls") ;
}
//@@end
}h action and i have return the code
its running sucessfully but am not able to perform the action plz help me
How can i import DataAttributeInfo..? i am using CE 7.2.. pls help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You shouldn't use DataAttributeInfo as it is an internal object, if I'm correct.
Use IWDAttributeInfo instead of DataAttributeInfo and it should work
(See also API doc of IWDNodeInfo.iterateAttributes() at http://help.sap.com/javadocs/nwce/ce711sp02/wdr/com.sap.wdr/com/sap/tc/webdynpro/progmodel/api/IWDNo...)
Cheers,
Robin
its running sucessfully but am not able to perform the action plz help me
What do you mean by that, can you be more clear?
Regards,
Anton
Edited by: Anton Dimitrov on Jan 22, 2010 5:51 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
check this link
/docs/DOC-8061#58 [original link is broken]
you can download the sap standard project and use the component in your project for export to execel
functionality .
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.