cancel
Showing results for 
Search instead for 
Did you mean: 

How can we read the contents of a textfile that is stored in the KM

Former Member
0 Kudos

Hi All

We are doing a Webdynpro application and we need to access the data of a textfile which is stored in the KM.

The actual problem is :I have a textfile in Knowledege Management(KM) , /documents folder .Now i need to access the contents of that textfile.

Please kindly help me in this regards as its urgent requirement for us.

Thanks in Advance

Thanks and Regards

Nishita Salver

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

This could help you

KM Search and Replace: Web Dynpro Java KM-API Example

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05c7e2ae-0a01-0010-ca98-fe4...

Regards

Ayyapparaj

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Thank you so much

The Problem is resolved.using your code i could get the data.

Thanks once again.

Thanks and Regards

Nishita Salver

Former Member
0 Kudos

Hi,

Thank you So much for a quick reply .It is regarding the KM retrieval.But i could not follow it properly.I would be grateful if you can send me the code itself as i very less time to implement it.

Thanks in Advance

Thanks and Regards

Nishita Salver

Former Member
0 Kudos

Hi,

Try the following

RID rid = RID.getRID("/documents/testext.txt");

try {

com.sapportals.wcm.repository.IResource resource = ResourceFactory.getInstance().getResource(rid, resourceContext);

if (resource != null) {

String text = "";

BufferedReader in = new BufferedReader(new InputStreamReader(resource.getContent().getInputStream()));

while ((text = in.readLine()) != null) {

wdContext.currentTextElement().setText(text);

}

}

} catch (RuntimeException e2) {

// TODO Auto-generated catch block

}

/thread/90181 [original link is broken]

Regards

Ayyapparaj