cancel
Showing results for 
Search instead for 
Did you mean: 

Very Simple Question - How to call KM links from EP

Former Member
0 Kudos

Hi Experts,

I have strored PDF in SAP EP KM at following location.

https://aass_dev.mycompany.com:50001/irj/go/km/docs/documents/mycompany/ess%20files/mycompany%20glob...

I have created LinktoURL UI element in my WD program. I have set property 'Reference' of LinktoURL UI element as https://aass_dev.mycompany.com:50001/irj/go/km/docs/documents/mycompany/ess%20files/mycompany%20glob...

The PDF stored in WD screen is getting called when user clicks on the link.

I have to transport the WD program from DEv to Quality. When I am transporting the program, the value of 'Reference" is hard coded. How I can avoid hard coding. I want the PDF stored in SAP EP Quality env to be called. The link will be like this

https://aass_quality.mycompany.com:50001/irj/go/km/docs/documents/mycompany/ess%20files/mycompany%20...

Please help

Regards,

Gary

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Use the KM class URLGenerator to generate the URL at runtime.

Former Member
0 Kudos

Hi Aviad,

Can you please provide more information on it.

Regards,

Gary

Former Member
0 Kudos

Hi Aviad,

I am unable to access the link mentioned by you. Can you kindly provide me some link from SDN or help.sap.com

Regards,

Gary

Former Member
0 Kudos

Hi,

I have created one valuenode in the context called Url. I have used following code:

	String hostName = TaskBinder.getCurrentTask().getProtocolAdapter().getServerName();
	
	if (hostName.equalsIgnoreCase("ruepd.mycompany.com"))
   {
 	wdContext.currentContextElement().setUrl("https://ruepd.mycompany.com:50001/irj/go/km/docs/documents/mycompany/ess%20files/mycompany%20global%20offices%20map.pdf");
   }

This code is working fine. How I can use the following code to get rid of hardcoding https://ruepd.mycompany.com:50001

To obtain a valid instance of an URL generator, proceed as follows: 

   IURLGeneratorService ug = (IURLGeneratorService)ResourceFactory
     .getInstance()
     .getServiceFactory()
     .getService(IServiceTypesConst.URLGENERATOR_SERVICE);
 To set a link from one page to another on the same server, we only need a relative URI; proceed as follows: 
   RID rid = ;
   IUriReference uriRef = ug.getResourcePageUri(PathKey.DETAILS_PAGE, rid,null);

   com.sapportals.htmlb.Link  link = new Link("detail", "Details");
   link.setReference( uriRef.toString() );

Following portion of code is not getting compiled.

RID rid = ;

Please help.

Regards,

Gary

Former Member
0 Kudos

RID rid = RID.getRID("<Path of folder>");

Former Member
0 Kudos

Hi Experts,

The following code is not getting compiled. I am getting error on .getInstance() line. The error is "The method getInstance is undefined for the type ResourceFactory. Please help.

public static void wdDoModifyView(IPrivateFirstView wdThis, IPrivateFirstView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
  {
    //@@begin wdDoModifyView
    
    
    
	IURLGeneratorService ug = (IURLGeneratorService)ResourceFactory
	  .getInstance()
	  .getServiceFactory()
	  .getService(IServiceTypesConst.URLGENERATOR_SERVICE);

Regards,

Gary

Former Member
0 Kudos

Why do you place your code in wdDoModify?

Former Member
0 Kudos

Hi,

I am working for a support project. The code was already there in wdDoModify. I put the code in wdDoInit as well for testing. The code is not working in wdDoInit as well.

For testing purpose. I tried to use following code

	IResourceFactory resourseFactory = ResourceFactory.getInstance();

Above code is also not getting compiled. I have imported the APIs bc.rf.framework_api etc

Pls help

Regards,

Gary

Former Member
0 Kudos

Try moving the code from wdDoModify to a proper event.

What is the compiliation error when you put it in wdDoInit?

Former Member
0 Kudos

Hi,

The compilation error when the code is put in wdDoInit is "The method getInstance is undefined for the type ResourceFactory. "

Please help.

Regards,

Gary

Former Member
0 Kudos

It means that you have imported the wrong jars.

Former Member
0 Kudos

Hi,

I have imported following api

bc.rf.global.service.urlgenerator_api

Is it incorrect?

Please provide me the list of correct api

Regards,

Gary

Former Member
0 Kudos

com.sapportals.wcm.repository

Amey-Mogare
Contributor
0 Kudos

Hi Gary,

I have successfully implemented KM api in my Web Dynpro DC.

Following are the ONLY JARs needed for it.

1.

bc.rf.framework_api.jar

bc.rf.global.service.urlgenerator_api.jar

bc.sf.framework_api.jar

bc.util.public_api.jar

com.sap.security.api.ep5.jar

com.sap.security.api.jar

prtapi.jar

Location for above JARS : - C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.km.rfwizard_7.1.5\lib

2. km.shared.ui.released_api.jar

Location of this JAR :- \usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.km.cm.ui\lib\

3. km.shared.service.indexmanagement_api.jar

Location of this JAR :- \usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.km.cm.service\lib

Let me know if you need any further help.

Thanks and regards,

Amey Mogare