Sei sulla pagina 1di 4

4/2/2019 Access KM files from ear file in NW 7.

31 | SAP Blogs

Products
Products Industries
Industries Services and Support
Services Support Training
Training Community
Community Developer
Developer

Partner
Partner About
About

 
Ask a Question Write a Blog Post Login

Former Member
February 7, 2014 4 minute read

Access KM les from ear le in NW 7.31


Follow RSS feed Like

1 Like 2,168 Views 2 Comments

In this blog describes the issues faced while accessing  KM les from ear le (iView in portal) in NW 7.31

Prerequisites

You have created a ear le project in NWDS and need to access KM les or folders

Issues faced

1. How to get required KM API?

          By default NWDS is not having KM related dependencies , you need to download below two SCA les from Service market
place relevant to your server           version.

          KMCCM and KMCWPC


https://blogs.sap.com/2014/02/07/access-km-files-from-ear-file-in-nw-731/ 1/4
4/2/2019 Access KM files from ear file in NW 7.31 | SAP Blogs

          Then import these sca les into NWDS from development infrastructure perspective.

          Next step is in development infrastructure perspective click in KMC-CM SCA le-> in Component properties-> overview tab-
>Archive store ->select the           downloaded SCA le and upload.

   2. Adding KM API jar les to ear le?

          Right click ear le project->Properties->Java build path->Add external Jars then select KM API from          
“LocalDevelopment\KMC-          CM\sap.com\tc\km\frwk\_comp\gen\default\public\api\lib\java”

          Next is the important step in ear project-> dist-> portal-INF->portalapp.xml->Application Tab->SharingReference -> add this
value           “com.sap.km.application” . Now you can access KM related classes in ear le.

           Below code is an example to access les from a KM folder and lists users having access to le.

IResourceFactory resourceFactory = ResourceFactory.getInstance();


com.sapportals.wcm.repository.IResourceContext resourceContext =
ResourceFactory.getInstance().getServiceContextUME(“cmadmin_service”);
RID rid = RID.getRID(“/documents/Files “);
com.sapportals.wcm.repository.IResource resourceN =
resourceFactory.getResource(rid, resourceContext);
            if(resourceN.isCollection())
{
ICollection collection=(ICollection)resourceN;
IResourceList resourceList=collection.getChildren();
IResourceListIterator iterator=resourceList.listIterator();
                  while(iterator.hasNext())
{
                        try{
IResource resource2=(IResource)iterator.next();                          
ISecurityManager securityManager
=resource2.getRepositoryManager().getSecurityManager(resource2);
IResourceAclManager irm =
((IAclSecurityManager)securityManager).getAclManager();
IResourceAcl resourceAcl = irm.getAcl(resource2);                    
                           
IResourceAclEntryList list = resourceAcl.getEntries();
IResourceAclEntryListIterator iteratorAcl =
list.iterator();                
                        while (iteratorAcl.hasNext()){
IResourceAclEntry entry = iteratorAcl.next();
System.err.println(entry.getPrincipalUME().getDisplayName());
}
}                    
}
} catch ( Exception e) {
System.err.println(“exception: “ +
e.getLocalizedMessage());
}

https://blogs.sap.com/2014/02/07/access-km-files-from-ear-file-in-nw-731/ 2/4
4/2/2019 Access KM files from ear file in NW 7.31 | SAP Blogs

                      
}
}

regards,

Rakesh Mathew

Alert Moderator

Assigned tags

SAP Enterprise Portal | SAP NetWeaver | km | Portal And Collaboration | sap netweaver |

Related Blog Posts

KM Cache for portal application les


By Tobias Hofmann , Nov 30, 2010
Masthead customization and deployment through NWDS
By RAVI DIKSHIT , Feb 13, 2015
Masthead Customization in NW 7.31
By Former Member , Aug 30, 2013

Related Questions

Ask about ESS user id and EHP 6 user id


By Former Member , Jun 19, 2017

SAP EP Portal Upgraded from NW 7.31 to NW 7.50


By Pankaj S , Nov 27, 2018

EP 7.0 Web Dynpro Java Project Import into NWDS


By Siddhartha Kanjilal , Jun 30, 2017

https://blogs.sap.com/2014/02/07/access-km-files-from-ear-file-in-nw-731/ 3/4
4/2/2019 Access KM files from ear file in NW 7.31 | SAP Blogs

2 Comments

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

Former Member

November 14, 2014 at 6:40 pm


Thank you for Nice Blog. Currently i am migrating from Netweaver 7.0 to Netweaver 7.4

Wanted to know can we develop Portal Components reading KM data with out NWDI. Your thoughts please.

Like (0)

Former Member

March 23, 2015 at 12:04 pm


Hi Rakesh,

I am also in search of a custom par application that fetches the data from a KM folder and displays the content
as links in portal. Can you let me know how to achieve this.

Thanks,

Krishna

Like (0)

Share & Follow

Privacy Terms of Use

Legal Disclosure Copyright

Trademark Cookie Preferences

Sitemap Newsletter

https://blogs.sap.com/2014/02/07/access-km-files-from-ear-file-in-nw-731/ 4/4

Potrebbero piacerti anche