cancel
Showing results for 
Search instead for 
Did you mean: 

SAPCRM KM-Repository: Resource property "contained_in"

Former Member
0 Kudos
158

Hello @ all,

in the pcui there is km-navigation iview (called infocenter that is part of the crm business package for CRM 4.0)which is displaying content of the "sapcrm" repository. The resources stored in this reposity are extend with a special proptery called "contained_in". With this property it is posible to link a resource with an business partner. The property is displayed as a link an you can easily access the crm pcui accountmangement by this link.

I want to extend an other reposity with this special property and I want to connect the resources in this rep with crm data.

Can someone explain me which are the necessary steps.

I don´t find the right settings in the cm-configuration.(EP6.0 SP2)

Thanks alot for your help.

Best regards

Kai

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Dimitry,

For me it seems that your anwser do not match my question.

I found the definition of the property "contained_in" in the cm-configuration. The displaying pattern for repositories and folders is set to all (no limits). When I use the same layout-set as the info-center navigation-iview has in a new one with root-folder in an other repository as "sapcrm" the property is not beeing displayed!

The property "contained_in" was integrated by deploying the business package for crm!

But I need this propery in an other repository too in the same way it is displayed and used in the repository sapcrm.

I do not understand this behaviour at this step!

Former Member
0 Kudos

Well sorry for misunderstanding then…

Print out the properties with the code I posted and have a look at the values in the repository “sapcrm” and in the repository in question. If you use the same layout set, the property probably does not exist in the target repository… so you would have to populate it somehow first.

With best wishes,

dimitry

Former Member
0 Kudos

Hi,

What you might want to try is adding a property in question to the collection renderer of the layout set your “alternative” navigation iView uses, please refer to the following document for more details: http://help.sap.com/saphelp_nw04/helpdata/en/79/a1d23e6b2c3d67e10000000a114084/content.htm

You might also want to print out all properties on the resource with the following routine to understand the logic behind it.


import java.util.List;

import com.sapportals.portal.prt.component.*;
import com.sapportals.wcm.repository.ICollection;
import com.sapportals.wcm.repository.IProperty;
import com.sapportals.wcm.repository.IPropertyIterator;
import com.sapportals.wcm.repository.IResource;
import com.sapportals.wcm.repository.IResourceFactory;
import com.sapportals.wcm.repository.IResourceListIterator;
import com.sapportals.wcm.repository.PropertyMap;
import com.sapportals.wcm.repository.ResourceContext;
import com.sapportals.wcm.repository.ResourceFactory;
import com.sapportals.wcm.repository.enum.PropertyType;
import com.sapportals.wcm.util.uri.RID;
import com.sapportals.portal.security.usermanagement.IUser;

public class KMPropertyPrinter extends AbstractPortalComponent
{
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    {
		String prop = request.getParameter("prop");
		if (prop==null) prop="/";
		
		RID rid = RID.getRID(prop);
		IUser contextUser = (IUser) request.getUser().getUser();
		ResourceContext resContext = new ResourceContext(contextUser);
		IResourceFactory aResourceFactory=null;
		
		try {
					aResourceFactory = ResourceFactory.getInstance();
					IResource res = (IResource) aResourceFactory. getResource(rid, resContext);

					PropertyMap ipm = (PropertyMap) res.getProperties();
					IPropertyIterator ipi = ipm.iterator();
					response.write("<h4>Properties:</h4>");
					response.write("<table border=1>");
					response.write("<tr><td><b>{namespace}name</b></td><td><b>type</b></td><td><b>value</b></td></tr>");
					
						while(ipi.hasNext()){
							IProperty ip = ipi.next();
							if (ip.isMultivalued()){
								List values = ip.getValues();
								String conc_string_of_values="";
								for (int i = 0; i<values.size(); i++){
									conc_string_of_values+=values.get(i)+",";
								}
								if (conc_string_of_values.lastIndexOf(",")!=-1) conc_string_of_values = conc_string_of_values.substring(0, conc_string_of_values.lastIndexOf(","));
								response.write("<tr><td>" + ip.getPropertyName() + "</td><td>" + getType(ip.getType()) +  "</td><td>"+ conc_string_of_values + "</td></tr>");
							} else {
								response.write("<tr><td>" + ip.getPropertyName() + "</td><td>" + getType(ip.getType()) +  "</td><td>"+ ip.getValueAsString() + "</td></tr>");
							}
							
						}	
					response.write("</table>");
					if(res.isCollection()){
					// if collection -> list all children
					response.write("<h4>Children:</h4>");
					ICollection col = (ICollection) res;
					IResourceListIterator irli =  col.getChildren().listIterator();
					response.write("<table border=1>");
					while (irli.hasNext()){
						IResource ir = irli.next();
						response.write("<tr><td><a href='https://answers.sap.com/irj/servlet/prt/portal/prtroot/com.btexx.km.pp.KMPropertyPrinter?prop="+ir.getRID().toExternalForm()+"'>"+ir.getRID().toExternalForm()+"</a></td></tr>");
					}
					response.write("</table>");
					}
				} catch (Exception e) {
					response.write("<font color=red>ERROR</font> "+e);
		}		
    }

		private String getType(PropertyType pt){
			if (pt==PropertyType.BOOLEAN) return "BOOLEAN";
			if (pt==PropertyType.DATE) return "DATE";
			if (pt==PropertyType.INTEGER) return "INTEGER";
			if (pt==PropertyType.LONG) return "LONG";
			if (pt==PropertyType.STRING) return "STRING";
			if (pt==PropertyType.XML) return "XML";
			return "unknown";
		}

}

& put <property name="SharingReference" value="htmlb, usermanagement, knowledgemanagement"/>

into your portalapp.xml file

regards,

Dimitry