cancel
Showing results for 
Search instead for 
Did you mean: 

iView interaction: open link target in another iView on same page

Former Member
0 Kudos

Dear friends,

i'd like to build following szenario: 1 page with 2 iViews, one KM iView and one Web Dynpro iView.

On click on a link in the KM iView I want to open the target in the second Web Dynpro iView.

Everything works fine if I open the link in a new window:

String strLink = "/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2ffolder!2fiViews!2ffolder!2fmyIview?DynamicParameter=id%3Dabc";
Link link = new Link(strLink);
link.addText("mylink");
link.setReference(strLink);
link.setLinkDesign(LinkDesign.FUNCTION);
link.setTarget("_blank");
link.setEnabled(strLink!=null);

I've read about EPCM and Portal Eventing, but I can't believe it is so complicated with subscribing

and raising an event and so on... I only want something like "open this link in this iview on the same page"

Thanks a lot for your help

Steffi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Stefanie,

If your KM iview is part of a page and you want the bottom row to display the WD app when a link is clicked then I think your only option is to use EPCM.

But it should be enough with just a few lines of code. I've done this many times using EPCM, and unless the communication is complex with many parameters and logic, all you really need is one line of code in your KM that raises the event with the necessary parameter(s) and maybe 2-3 on your WD app (in the wdinit method).

Cheers,

Dion

Former Member
0 Kudos

Hey Dion,

thanks a lot for your quick answer!

Ok, I'll try it with EPCM. But I even don't know how this works.

I'm creating the link which should load the second iView in a property renderer. In this renderer I have to raise an event like:

Link link = new Link(strLink);
link.setOnClick("return EPCM.raiseEvent('namespace', 'eventName', 'eventData')");

And how do I send along my parameters? And do I also have to subscribe the event in the link via JavaScript?

And on the other hand, the second iView which should show the link, in the Web Dynpro wdDoInit() I have

WDPortalEventing.subscribe ("namespace", "eventName", "myEventAction()");
...
public void myEventAction()

Another question: how do I get the URN for my iView? Is it my package name of the WDapplication and the application name? something like de.myCompany.portal:myApplication?

<URN>::="urn:" <Namespace_identifier> ":" <Namespace_Specific_String>

Sorry for that stupid questions, but I'm not able to find any understandable explanation or example source code...

Thanks a lot

Steffi

Former Member
0 Kudos

Hi Stefanie,

you can "hardcode" the javascript event on the link in the way you described or you can use the EpcfTooolbox to help you generate the javascript code in your KM iview. This interface is part of the portal api.

[EPCF Toobox|https://help.sap.com/javadocs/NW04S/current/ep/com/sapportals/portal/prt/service/epcftoolbox/IEpcfToolbox.html]

Using this interface means writing a few more lines of code but it will protect you from any future changes to the EPCF api by SAP.

From a glance your WD portal eventing looks ok to me. It doesn't really matter what urn you put in, it can be anything but normally you use the namespace of the application, or a variation of it. There should be several exmples on SDN and help.sap.com on using eventing in WD.

There's generally many examples on eventing on the SDN forums, but you're somewhat right about the documentation, it is a bit "flimsy" and all over the place with examples hard to find unless you know what you're looking for. If you do a search on raising event using iview or something similar to that on this forum you're bound to get several examples. Also, do a search with EpcfToolbox on google or SDN and you should find examples on using that as well.

Cheers,

Dion

Former Member
0 Kudos

Hey Dion,

thanks to bring me on the right track!

The mistake was that

link.setOnClick("return EPCM.raiseEvent('namespace', 'eventName', 'eventData')");

throws an error in the Navigation iView.

Using

link.setReference("javascript:EPCM.raiseEvent('namespace', 'eventName', 'eventData')");

solved it.

Thanks a lot

Steffi

Answers (0)