Skip to Content
Author's profile photo Poojith M V

Retrieve all subscriptions for a KM document

        Retrieve all subscriptions for a KM document

 
 

Steps to be carried out in portal:

  1. 1.       Launch SAP Enterprise and login with user ID having system admin role
  2. 2.       Navigate to System Configuration –> Content Management –> Repository Managers –> CM Repository
  3. 3.       Select any working repository and click on “Edit” to add service “Subscription” from the list as shown below

                 Repository_setting.jpg

  1. 4.       Save the changes.
  2. 5.       Save the settings.
  3. 6.       Add few documents to the repository selected.
  4. 7.       Navigate to http://<host>:<port>/irj/go/km/docs/<repository path>.
  5. 8.       Select the context menu for the document and click “Details”. Then select Subscription and enter the details and click on “Save Subscription” to subscribe to the document.

                 Comment_Enabling.jpg

Steps to create the application in NWDS:

  1. 1.       Launch NWDS and navigate to Enterprise Portal perspective.
  2. 2.       Choose File à New à Project.
  3. 3.       Select “Portal Application” from the wizard and click “Next”.
  4. 4.       Enter the project name and the location where the project need to be saved.
  5. 5.       Click on “Finish” and a new project with the name given in step 4 is displayed.
  6. 6.       Right click on the created project àNew àOther
  7. 7.       Select Portal application from the right hand side menu item as shown below
  1. 8.       Click on “Next” and select the project.
  2. 9.       Click on “Next”  and select “Abstract Portal Component” under portal component as shown below.
  1. 10.   Click on “Next” and fill in the required details and click on “Finish”.
  2. 11.   Once the component is created double click to open in NWDS.
  3. 12.   Copy the below code and paste it in the doContent() method

    

 IResourceFactory resourceFactory = null;
      RID rid = null;
      IResourceContext resourceContext = null;
      IResource resource = null;
      ISubscriptionManager subscriptionManager = null;
      ISubscriptionList subscriptionList=null;
      try  
      {          
             rid = RID.getRID("<Path of the KM document>");
             resourceFactory = ResourceFactory.getInstance();
             resourceContext =
ResourceFactory.getInstance().getServiceContext("subscription_service");
            resource =  resourceFactory.getResource(rid, resourceContext);
            subscriptionManager =
SubscriptionUtils.getSubscriptionManager(resource);
            if(subscriptionManager!= null)
            {                       
                  if(resourceContext!= null && rid != null)
                  {
                        subscriptionList =
subscriptionManager.getSubscriptions(resourceContext,rid,true);
                        for (int i = 0; i < subscriptionList.size(); i++)
                        {
                              response.write("details"+subscription.get(i));
                        }            
                  }
            }
}
  1. 13.   Add the missing imports and add any required jars and deploy the application on the portal. The application will list out all the subscription for a document
  2. 14.   Location of the required jars can be found at http://sapjarfinder.com/

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.