on 04-20-2010 12:30 PM
Hi,
how to create log file using km api . please provide me if any sample code available.
Thanks and Regards,
Nari.
problem resolved by self.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nari,
Please have a look at [Knowledge Management using WebDynpro |http://wiki.sdn.sap.com/wiki/display/Snippets/UpdateKnowledgeManagementusingWebDynproJavaApplication]
Yon can create text file in wd Java and placed in the KM using KM API
Hope it helps
Regards
Arun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Narikk,
You have to edit portalapp.xml file.
for example:-<?xml version="1.0" encoding="UTF-8"?>
<application>
<application-config>
<property name="SharingReference" value="usermanagement, knowledgemanagement, landscape, htmlb, exportalJCOclient, exportal,com.sap.km.cm, com.sap.portal.pcm.admin.apiservice, com.sap.portal.pcd.glservice"/>
<property name="ServicesReference" value="com.sap.portal.ivs.api_iview, com.sap.portal.ivs.api_landscape, SAPJ2EE::library:tckmcbc.uwl~api"/>
<property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
</application-config>
<components>
<component name="Email">
<component-config>
<property name="ClassName" value="com.amat.Email"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
</components>
<services/>
</application>
Hope this may help you.
Deepak!!!
Thanks for your quick reply but one more requirement is... here i can able create text file in km and adding content to created text file on the same line but i want to update new content in next line(newline).Please see below code and correct it.
Date dt = new Date(Calendar.getInstance().getTimeInMillis());
com.sapportals.portal.security.usermanagement.IUser iuser = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IResourceContext irCtx = new ResourceContext(iuser);
RID docsResource = RID.getRID(filepath);
IContent initCont = new Content(new ByteArrayInputStream("".getBytes()),"text/plain",-1,null);
if(ResourceFactory.getInstance().getResource(RID.getRID(filepath+"/"+filename), irCtx) == null)
{
ICollection docsColl = (ICollection)com.sapportals.wcm.repository.ResourceFactory.getInstance().getResource(docsResource,irCtx);
docsColl.createResource(filename,null,initCont);
}
String InputData = Exception;
RID sugg_html = RID.getRID(filepath+"/"+filename);
IResource resource = com.sapportals.wcm.repository.ResourceFactory.getInstance().getResource(sugg_html,irCtx);
String existingComments;
IContent cont = resource.getContent();
BufferedReader buf_in = new BufferedReader(new InputStreamReader(cont.getInputStream()));
existingComments = buf_in.readLine();
existingComments = existingComments+" "+"\n"+dt+InputData;
ByteArrayInputStream inputStream = new ByteArrayInputStream(existingComments.getBytes());
cont = new Content(inputStream,"text/plain",-1,null);
resource.updateContent(cont);
cont.close();
Hi Surya,
Please refer to below documents for adding refrences http://help.sap.com/saphelp_nw70/helpdata/en/1f/26b742cafec96ae10000000a155106/frameset.htm
/docs/DOC-8557#section17 [original link is broken]
Hope it helps
Regards
Arun
Hi Narik,
In the Text file use can not use "\n" for new line, it will not work.
You can do few thing:-
1>try to save .doc file in KM, in place of text file. Then "\n" will work as per your requirment.
2> user "\t" tab and format the file .txt file.
I have written below simple java program to write in a file:-
public class TestingJava {
* *
* *
* public static void main( String [] args ) throws Exception*
* {*
* try {*
* BufferedWriter out = new BufferedWriter(new FileWriter("c://ep docs/hello.doc"));*
* out.write("aString \n hello");*
* out.close();*
* } catch (IOException e) {*
* }*
* *
* }*
}
Try this code and change file type in the path;-c://ep docs/hello.doc to better understanding...:)
Hope this may help you.
Deepak!!!
Edited by: Deepak Arora on Apr 22, 2010 8:47 AM
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.