cancel
Showing results for 
Search instead for 
Did you mean: 

error in simple "eventing" code : 'EPCM' is undefined"

Former Member
0 Kudos

Hi

i need to achieve the following and we are on EP 5.0

error : 'EPCM' is undefined"

=================================================================================

left page | right page

=================================================================================

tab1(view1) |

tab2(view2) | displays "View" depending on the selection in the left page

tab3(view3) |

=================================================================================

if I click a link in iView1, I need to display iView2 in the right side of a page.

i see that we need to use eventing. As am new to portals, I couldn't able to make Eventing work.

I looked at PDK demos of eventing at sdn.sap.com and came up with something like this

I created 2 Java iViews using iViewEditor and had put the 2 iViews in a Page.

left iView has got tabs which should pass the iView links to the right iView (right side page).

I am getting the following error. 'EPCM' is undefined"

even if EPCM works, i am not sure if the iVIew link path, i am passing is correct to be displayed in the right side. i stored iViews in a role and trying to use that link.

============

Sender Event

============

<script>

document.domain = 'domain.com';

function CallIView(pageID){

EPCM.raiseEvent('domain.events', 'CallIView', pageID);

}

function GoToIView(iView) {

window.alert("Go to iView: " + iView);

}

</script>

raising an event

============

Receiver Event

============

<script language="javascript">

document.domain = 'domain.com';

if ((typeof EPCM) != 'undefined') {

EPCM.subscribeEvent('domain.events', 'CallIView', window, 'CallIView');

}

function CallIView(pageID){

var strURL;

document.frmPost("TEMPLATE_ID").value = pageID;

strURL = '<SAP_BW_URL>';

window.navigate(strURL);

}

</script>

I am very much thankful if any one can help me to solve this issue as I got to submit this immediately. I appreciate if anyone give me a chance to talk to you to look at complete code and discuss more in detail so that I make sure that what am asking is making some sense in this forum.

awaiting your urgent help.

thanks

Veeru

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Plz check out u have added EPCM as servicereference in ur profile.

Hope it helps.

Regards,

Jigesh.

Former Member
0 Kudos

What does this mean? "EPCM as servicereference in your profile"?

Former Member
0 Kudos

this may or may not help you. i saw 'document.domain' and it rings the bell. if the contents in your iviews are provided by one or more applications external to the portal, for example another website, you really need to pay attention to things like cross domain scripting, javascript origin policy etc. also read on EPCMProxy.

if you are indeed mixing contents from multiple sources (portal and non-portal), in short, you need to

#0 use full domain in the url. for example, myhost.mycompany.com,instead of simply myhost, for both the portal and the external app.

#1 include epcfproxy.js in the document returned by the external web application. the file itself is in the pdk somewhere, but not part of prt.

#2 relax the domain by removing the hostname. in other words, the document domain becomes just .mycompany.com.

#3 in the iview, use EPCMProxy object instead of EPCM.

the assumption here is that both portal and the external app run within the same company, in other words they have the same .mycompany.com part, but perhaps running on differnt servers. if this is not true, you will never be able to script across the iframes due to javascript origin policy implemented by most browsers.

wentao