Skip to Content

Recently, I had to prepare the “Document Access Report Sample” [Enhancing Customer Reports with Commands and Parameters] to be used on the production server. Here I am going to share a couple of tips that I found useful during the configuration of this KM Report. They may help you if you need to make a custom KM report.

A. How to change the report column names in the KM report header?

When the first time you deploy the report sample, the report result header looks like this:

image

The custom properties that are used in the report are shown as the property real names in the columns and in the filter dropdown. To modify the names in the columns and the filter dropdown there are two ways. The first way is to implement the getDisplayName method of IReport interface like how it is done in the sample. However, for some reason this method is not being called by KM Report UI Component and the display names are set to the property names (It might be a small bug in the Report Result Control, release EP7.0.6.) If it doesn’t work for you too, you can use the following configuration process as a clean work around.

The property names like lastaccess, access_count, and unique_count are used in the sample report. These names appear at the table header by default. To show the display names from the text resource bundle, you just need to define the properties in the KM property metadata service configuration and assign them to the resource bundle file. To define the properties and the labels in the KM Property Metadata, follow the steps:

1. Open KM Content Management under System Administration->System Configuration

2. Open Global Services

3. Open Property Metadata (Property Definition)

4. Add the Namespace

&nbsp&nbsp&nbsp&nbsp&nbsp4.1. Open Namespaces

&nbsp&nbsp&nbsp&nbsp&nbsp4.2. Click on the “New” button

&nbsp&nbsp&nbsp&nbsp&nbsp4.3. Give a unique name to the namespace alias

&nbsp&nbsp&nbsp&nbsp&nbsp4.4. The namespace should be the property namespace that is used in the report, in the case of the example, it is “http://sap.com/km/stats”

&nbsp&nbsp&nbsp&nbsp&nbsp4.5. Return to the Property Metadata page

5. Add the Metadata Extension

&nbsp&nbsp&nbsp&nbsp&nbsp5.1. Open Metadata Extensions

&nbsp&nbsp&nbsp&nbsp&nbsp5.2. Click on the “New” button

&nbsp&nbsp&nbsp&nbsp&nbsp5.3. Choose a unique name for your Extension

&nbsp&nbsp&nbsp&nbsp&nbsp5.4. The bundle file can be a resource bundle file in the report package or any resource bundle file that is deployed in a par file. For the sample report, it should be “com.sap.netweaver.km.stats.report.DocumentAccessReport”.

&nbsp&nbsp&nbsp&nbsp&nbsp5.5. Return to the Property Metadata page

6. Add the custom property (repeat this step for all the custom properties that you have in the report)

&nbsp&nbsp&nbsp&nbsp&nbsp6.1. Open Properties

&nbsp&nbsp&nbsp&nbsp&nbsp6.2. Click on New button.

&nbsp&nbsp&nbsp&nbsp&nbsp6.3. Enter a unique ID for the property

&nbsp&nbsp&nbsp&nbsp&nbsp6.4. Enter the name of the property in the Property ID field

&nbsp&nbsp&nbsp&nbsp&nbsp6.5. Select the Namespace Alias that you just created from the list

&nbsp&nbsp&nbsp&nbsp&nbsp6.6. Select the appropriate type for the property from the list

&nbsp&nbsp&nbsp&nbsp&nbsp6.7. Select the Meta Data Extension that you just created

&nbsp&nbsp&nbsp&nbsp&nbsp6.8. Fill the key for label with the key in the resource bundle file which is DocumentAccessReport.properties for this report (e.g. use report.disp.lastaccessed for lastaccessed property.)     

&nbsp&nbsp&nbsp&nbsp&nbsp6.9. Leave other fields unchanged

Now the report component retrieves the property labels from the keys in the resource bundle that are specified in the Property Metadata service and it will look like this:

image

You can also export all the property metadata that you create to an xml file using the Export feature and import them into your production server.

B. How to modify the xml output of the report?

The report users might also want to use the xml output. This xml file is rendered by an XSLT file that is common for all the reports. However, you can specify one XSLT file for each report in EP7.0 and probably some earlier releases.  The default XSLT file is stored in the root of reporting repository (/Rerporting) and its name is “report-result.xslt”. The first step is to download this file and make your changes based on your requirements. One of the changes that you most likely need is to modify the column names again.

From this:

image

To this:

image

After modifying the XSLT file, upload it with a new name into the same location or any location.

 

Now there are two ways to use this new XSLT file in the report xml output. The first way is through the Content Configuration. Here are the steps to assign the XSLT file to a report:

1.     In the KM Configuration->Content Cofiguration, Open Content Managers

2.     Click on Show Advanced Options

3.     Click on Reports under related topics

4.     Select your report (DocumentAccessReport for the sample report)

5.     Click on the Edit button

6.     Put the uploaded XSLT file path (e.g. /reporting/new-report-result.xslt) in the “Result XSLT” field.

7.     Click on OK!

We have to repeat these steps when installing the report on another server. However, in the second way this path will be automatically deployed with the other configuration parameters within the par file. In the report project under folder /src.config/install/data/cm/repository_managers/reports there is a file named documentaccess_report.co.xml which contains the report properties:

You can add the result XSLT path in this XML config file by adding the following line in the Configurable node with resultXslt (case sensitive) property:

  

To make sure the property is set properly for the report, you can view the report properties in the reports table (go to step 3). If the path is not there try to delete the report from thelist and deploy the par file again. It will create the report in the list with all its properties.

To report this post you need to login first.

6 Comments

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

  1. david cole
    Amir – This weblog was a big help for me as I recently implemented this solution in EP7 SP9. Thanks for taking the time to post it !

    A quick question. The report has two bugs that I am seeing and I was curious if you have dealt with this issue. 1) The option to only report on documents which have been read does not work. 2) The property unique_count doesn’t work.

    When I imported this project I had to update many of the class references. Can you share your classpath file with me ?

    (0) 
    1. Amir Madani Post author
      David,

      1. The read only option: I am not sure there was a bug there. It was working for me.

      2. The unique count: the service has a bug that the accumulate attribute in the service is not being configured properly. I needed that the unique count be always reflected in the report. So I removed the accumulate attribute from the service config file and set CFG_ACCUMULATE (in the service class) constantly to false. 

      3. The class path: you can add all the KM jar files to the class path. It makes the eclipse a bit slower but saves a lot of time you have to look for the classes in the jar files.

      (0) 
      1. david cole
        Thanks ! I was able to get the unique count property to work.

        I have a request to display this report by user. Could this report be enhanced to display this information ?

        (0) 
          1. Kai Chalker
            Hi,

            I am trying to get this currently to work properly, but currently having an error with a class file com.sap.netweaver.km.monitor.IMonitorInfoProvider.

            If you have a completed par file for this deployment I would really, really appreciate it.

            Great blog and would love to see more…..

            chalkerk@whl.co.uk

            (0) 
  2. Paul Mikota
    I implented this project on our Portal and followed the suggestion to remove the accumaltive property.

    Everything seemed to be working fine.

    When I ran the report on a KM rep, all values were populating fine. unique, count, last access.. etc…

    Then after adding the Repository Service to another KM rep folder, the whole thing stopped working.

    Only the Modified State was populating correctly.

    Any ideas? Maybe something to do with the Application Service… Or a KM database setting?

    I tried starting from scratch again.

    Removed the Repository services and report, re-uploaded the original PAR file and re-did all the setup work that I original had done to get it working.

    No go.

    (0) 

Leave a Reply