Skip to Content
0
Former Member
Nov 27, 2006 at 08:11 PM

Copying files in SAP KM

28 Views

Hi,

I am trying to programatically copy file from one folder to another dynamically created folder in KM.

Source path : /documents/source/OnAccessScanLog.txt

Destination path: /documents/sf1/

here is the code I am using:

//Resource Id for Source path

RID ridSource = RID.getRID("/documents/source/OnAccessScanLog.txt");

IResource rSource = resourceFactory.getResource(ridSource, resourceContext);

//Dynamically creating new folder "sf1" under "/documents" folder

ICollection col = (ICollection) ResourceFactory.getInstance().getResource(RID.getRID("/documents"),resourceContext);

col.createCollection("sf1",null);

//Resource Id for destination path

RID ridDest = RID.getRID("/documents/sf1");

IResource rDest = resourceFactory.getResource(ridDest, resourceContext);

//copy file from source to destination

rSource.copy(rDest.getURI(),null);

This code is throwing null error. Can anyone help me correcting this code ?

thanks

SBK