cancel
Showing results for 
Search instead for 
Did you mean: 

Can I download a file in KM Using Filedownload UI....

Former Member
0 Kudos

Dear Experts,

Can I download a file stored in KM (pdf), using Filedownload UI??

If yes then please suggest how could I do that.

Warm Regards

Upendra Agrawal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

you have to add the KM service in the Sharing Reference of Web Dynpro

Portal:sap.com/com.sap.km.application

with this API you can reach the CM link.

Assign this link to you download UI.

look in this Thread.

/thread/1378577 [original link is broken]

regards

Gunter

Edited by: Gunter Werner on Jun 26, 2009 2:40 PM

Former Member
0 Kudos

Dear Gunter,

Thanks for your quick reply, but it would be very helpful if you may suggest how may I achieve it.

Kindly explain as I have never done this before.

Warm Regards

Upendra Agrawal

Former Member
0 Kudos

Hi,

Go throught this links

/people/bobu.georgeputheeckal/blog/2006/12/22/getting-an-image-from-km-documents-to-be-used-in-web-dynpro

If you want the code..

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser ep5User = 
com.sapportals.wcm.util.usermanagement.WPUMFactory.getUserFactory().getEP5User(sapUser);
 
ResourceContext context = new ResourceContext(ep5User);
/*Give the path to KM in the variable path */
RID rid = RID.getRID("/documents/DENEME");
IResourceFactory factory = ResourceFactory.getInstance();
ICollection folder = (ICollection) factory.getResource(rid,context); 
String location = "E:\DynproTempFolder\";
String fileName = location+"a.pdf";
File file = new File(fileName);
 
// IResource res_forMap = ResourceFactory.getInstance().getResource(rid, context);
// IPropertyMap pm = res_forMap.getProperties();
 
String mime = new MimetypesFileTypeMap().getContentType(file);
 
 
/*Create an output stream for writing to the temperory location*/ 
/*From the temporary location read the file using an input stream*/
 
FileInputStream fin = new FileInputStream(fileName);
// fin.read();
 
/*Using this input stream we can write to the repository
Content content = new Content(fileelement.getFiledata(),fileelement.get) */
 
 
Content content = new Content(fin,"byte", -1L);
 
IResource newResource = folder.createResource("a.pdf",null,content);
  
fin.close();

Regards,

Saleem

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

This has been discussed many times, have a look at this links

You can check this sample example from SDN

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40db4a53-41a9-2910-d4a2-9c28283f...

Uploading and Downloading Files In Web Dynpro Java

/people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081...

http://help.sap.com/saphelp_nw04/helpdata/en/43/85b27dc9af2679e10000000a1553f7/content.htm

Uploading and Downloading Files In Web Dynpro Tables

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982c...

Some more links regarding Uploading and DownLoading Files

Hope this helps you...

Regards,

Saleem