on 06-28-2006 10:08 AM
Hi
i have a get a URL for a xml file and i want to download in in client machine so how can i download it.
i have tried the filedownload UI element but it's not working so please tell me what all other options i can try for.
Thanks in advance
What means "is not working"?
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i have placed a file download element on the view and bind it to context attribute <b>FileDownLoad</b> and written bellow code in wdDoInit method
IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("FileDownLoad");
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
binaryType.setFileName(url);
binaryType.setMimeType(WDWebResourceType.XML);
then when i run the application and click on the download link noting happans no file is downloaded and no error comes
Hi nk
The code you typed has been outdated starting since NW 2004s I think. Try to bind property "resource" and property "text" of the control instead of modifying the simple type. Use the following to create the web-resource on runtime
IWDResource reportResource = WDResourceFactory.createResource(
binaryFileData,
fileName,
WDWebResourceType.XXX);
BR
Sergei
nk
If you have web-resource already try to do the following. Create new attribute in the context of type "com.sap.ide.webdynpro.uielementdefinitions.Resource" and bind property "resource" of your FileDownload control to the attribute. Set the value of the attribute to your real web-resource. In addition, bind property "text" to the name of the file persisted in the context too. This way is better then the way of modyfing simple type you wrote before.
Anyway regarding your code I guess the attribute "FileDownload" is not bound to the FileDownload control. The control has outdated property "data" for this. If the binding is OK maybe you did not put binary data in the attribute "FileDownload" on runtime.
BR
Sergei
hi Sergei
I am totaly confused i will tell you in detail what i have done. please tell me where to modify now.
my file download element don't show property "resource" i bound it to a data property to a attribute of type binary and then written the bellow code in wdDoInit.
String xmlStr ="<?xml version=\"1.0\" encoding=\"utf-8\"?><MT_TEST><Recordset><Row><DT_TEST>aaa</DT_TEST></Row></Recordset></MT_TEST>";
final IWDCachedWebResource resource = WDWebResource.getWebResource(xmlStr.getBytes("UTF-8"),WDWebResourceType.XML);
resource.setResourceName("XML_inline.xml");
resource.setAttachement(false);
IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("FileDownLoad");
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
binaryType.setFileName(resource.getAbsoluteURL());
binaryType.setMimeType(WDWebResourceType.XML);
please tell me where i have to modify the code
thanks a lot for your suggetion
Hasn't your FileDownload control got property "resource" along with property "data"? It seems you have Webdynpro older than mine. In the case try to modify your code like this
IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute("FileDownLoad");
IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
binaryType.setFileName("XML_inline.xml");
binaryType.setMimeType(WDWebResourceType.XML);
wdContext.currentContextElement().setAttributeValue("FileDownLoad", xmlStr.getBytes("UTF-8")); // write binary data to the context
BR
Sergei
Hi
that is solved but now i have one more problem like i have a table and on one link i have provided a file download element and the string come in above mention code is returned from a web service and i have to run the web service everytime to generate the string so what can be the best solution. or i have to repeate the same procedure for all the lines.
Hi nk
There is a method to avoid putting binary data from all the web-services before generation of the table. Binding a web resource to FileDownload control to "resource" property allows to call your web-service to get content of each file directly at time of clicking by the link. I mean the file content would be obtained from the web service when user is clicking the link. Unfortunately it seems your Webdynpro version does not allow to do this because "resource" property is missing.
BR
Sergei
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.