Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
preeti_pradhan
Explorer
0 Kudos

Introduction


In SAP Knowledge management we generally use standard Property renderer for standard SAP KM properties for a resource.However we may be in need to create the custom properties for our KM documents and show the property differently while rendering.

Create Property Group


System Administration - System Configuration - Knowledge Management - Content Management - Global Services - Related Areas - Property Metadata - Groups - Groups - New



 

Create Property Group "FunctionalGroup"

 

 

Create Property


Navigate to System Administration - System Configuration - Knowledge Management - Content Management - Global Services - Related Areas - Property Metadata - Properties - New

and create property with Property ID as  "FunctionalUser" and use the property group created above in configuration. We have created this property as String.

 

Create Property Structure


To have the property displayed in a group, we need to create the Property  structure at below path :

System Administration - System Configuration - Knowledge Management - Content Management - Global Services - Related Areas - Property Structures - Property Groups - Property Group - New

Create the structure as "FunctionalUserGroup" and in Group items add the Property as FunctionalUser

Add (Structure) Group to all_groups Group


Select all_groups - Edit and add the above "FunctionalUserGroup" group to it.

 

If you want to assign values to this Property

Go to Content Administration - KM Content - Navigate to document that you want to assign the properties to.



You can add any string value to this and save.

 

If you want to retrieve this value and show in different font in XML Form builder - Show form , we need to create a custom property renderer .

 

Custom PropertyRenderer :


1)Go to NWDS and create the Portal Application project.FunctionalUserRenderer

2) Create a Java file with name  FunctionalUserRenderer.java

  •    This should implement the IModelledPropertyRenderer class


3) This class needs to implement the method below :

public Component renderProperty(IProperty arg0, IMetaName arg1,
IResource arg2, IProxy arg3, IParameters arg4) throws WcmException

 

4) You can get the properties using the below code for resource :

IPropertyMap listprop = arg2.getProperties();

IProperty FunctionalArea = listprop.get(PropertyName.getPN("http://sapportals.com/xmlns/cm", "FunctionalUser"))

5) Suppose the KM document has FunctionalUser property set to Fin and you want to display For Finance Users, you can create a String message and have condition check for FunctionalArea

If (FunctionalArea == "Fin")

message = "For Finance Users"

6) You can use TextView to display this.

TextView FunctionalArea= new TextView();
FunctionalArea.setEncode(false);
FunctionalArea.setText("<font size=0.3em><b>"+message+"</b></font>");

 

Create PropertyRenderer:


Navigate to System Administration - System Configuration - Knowledge Management - Content Management - Global Services - Related Areas - Property Metadata - Property Renderer- New

Give the Name as "FunctionalPropertyRenderer" and set the class  as "FunctionalUserRenderer"

 

Property Mapping to Use new renderer:


Navigate to System Administration - System Configuration - Knowledge Management - Content Management - Global Services - Related Areas - Property Metadata - Properties and

Search the Property created by you "FunctionalUser".

Edit and Select theProperty Renderer as  "FunctionalPropertyRenderer" and Save.

 

Now this Property will be rendered and showed to end user as per the new Renderer.

 
Labels in this area