Skip to Content

Procedure for KM Content Access  from NetWeaver 7.3

1.   Specifying the Dependencies of a KM Development Component

http://help.sap.com/saphelp_nw73/helpdata/en/4e/58bd98f2c55656e10000000a15822b/frameset.htm

2. Create and add external library to DC contaning “com.sap.security.api jar”

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/006a6229-b1ed-2e10-0c8c-cc5673cf268f?QuickLink=index&overridelayout=true

3. Add following code in web dynpro Code.

String pathofkmfile=”/documents/Public Documents/TREX.txt”; //Path of KM file can be changed as Required

 

try {

   IUser sapUser=   WDClientUser.getCurrentUser().getSAPUser();

   ResourceContext  contex= ResourceContext.getInstance(sapUser);

   IResourceFactory factory = ResourceFactory.getInstance();

   RID rid =RID.getRID(pathofkmfile);

  

   final IResource kmResource = factory.getResource(rid,contex);

   

   if(kmResource==null){

      throw new ResourceNotFoundException(“KM Resource Not Found”+kmResource.getDisplayName());

   }

  

   InputStream in =  kmResource.getContent().getInputStream();

   InputStreamReader is = new InputStreamReader(in);

   StringBuilder sb=new StringBuilder();

   BufferedReader br = new BufferedReader(is);

   String read = br.readLine();

   while(read != null) {

       sb.append(read);

       read =br.readLine();

   }

   wdComponentAPI.getMessageManager().reportSuccess(sb.toString());

}

catch (Exception e) {

           wdComponentAPI.getMessageManager().reportException(e);

}

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

    1. Dillip kumar Post author

      Though com.sap.security.api jar is Standard one but this is not available with  tc/km/frwk dc of KMC- CM SC. So the code gives compiler error in central build without com.sap.security.api jar as external lib.

      (0) 

Leave a Reply