Start of Content Area

Syntax documentation EPCM Proxy  Locate the document in its SAP Library structure

The EPCM proxy enables the EPCF functions for portal applications that are rendered in their own IFrame (for example, ITS-based applications and BSP).

Reload Function and Event-Subscription

The EPCF event methods are used by function reference. Since the references are kept across the IFrame borders, the references become invalid whenever the IFrame content is reloaded. To solve this problem, you have to use the second signature of the EPCM.subscribeEvent method that references to the current window object.

EPCM.subscribeEvent(nameSpace, name, window_reference, method_name)

External applications (for example, BSP, BW-Reports) are rendered in their own IFrame. The EPCM Object therefore can convert the event handler registration from [window_reference,method_name] to [iframe_name,method_name]. With this conversion the method keeps the name and not the object/method reference. When the IFrame content is reloaded now, the iframe_name and method_name are still valid and the event handler, that is located inside the IFrame, can be called from the EPCM event manager outside the IFrame using the following call:

window.frames[iframe_name][method_name]( event_data )

IncludeProxy

To simplify the implementation, the EPCMPROXY object is provided that serves as the proxy. The EPCF calls within the IFrame are delegated by the proxy layer to the upper EPCF layer. So instead of EPCM calls you use EPCMPROXY. The EPCMPROXY object is defined in the JavaScript file epcfproxy.js that comes with the portal. The JavaScript file epcfproxy.js has to be included into your portal application.

Usage

<HTML> 
<HEAD> 
<TITLE>EPCMProxy test example</TITLE> 
<!-- This is a general proxy to delegate all EPCM calls to the upper frame --> 
<SCRIPT src="epcfproxy.js"></SCRIPT> 
<SCRIPT>// 
  var lnDotPos = document.domain.indexOf( "." ); 
  if(lnDotPos>=0)document.domain = document.domain.substr( lnDotPos + 1 ); 

  function run() { 
   // call EPCF method via proxy (transparent for End-User 
   EPCMPROXY.subscribeEvent( "urn:com.sapportals.portal.epcmdemo.animals",
         "onAnimalSelect", window, "handleEvent"); 
   showCurrentAnimal(); 
  } 

  function showCurrentAnimal() { 
   var lsAnimal = 
   EPCMPROXY.loadClientData("urn:com.sapportals.portal.epcmdemo.animals",
                            "animalstored" ); 
   if (lsAnimal == null){ lsAnimal = "unknown"; } 
   document.getElementById( "infoBox" ).innerHTML = lsAnimal; 
  } 
 
  function handleEvent( evt ) {
    showCurrentAnimal(); 
  } 
  
  function showEPCMdata(){ 
   var data = "" 
   data+= "\n EPCMPROXY.getUAType="+EPCMPROXY.getUAType()</STRONG>; 
   data+= "\n EPCMPROXY.getUAVersion="+EPCMPROXY.getUAVersion()</STRONG>;
   data+= "\n EPCMPROXY.getUAPlatform="+EPCMPROXY.getUAPlatform()</STRONG>;
   data+= "\n EPCMPROXY.getUAVersion="+EPCMPROXY.getVersion()</STRONG>; 
   data+= "\n EPCMPROXY.getInstanceId="+EPCMPROXY.getInstanceId()</STRONG>;
   data+= "\n EPCMPROXY.getUniqueWindowId="+EPCMPROXY.getUniqueWindowId()
              </STRONG>; 
   alert(data); 
  } 
</SCRIPT>

</HEAD> 
<BODY onLoad="run()"> 
<DIV class="header"> EPCMProxy test component </DIV> 
<P> 
<BUTTONonClick="location.reload()">reload</BUTTON> 
<BUTTONonClick="showEPCMdata()">show EPCM Data</BUTTON> 
<DIVid="infoBox"></DIV> 
</BODY> 
</HTML> 

 

Note

There must be document - domain alignment so that the parent EPCM object can be accessed across the IFrame border. See section JavaScript Origin Policy for more details.

Use the object-call-signature‚ with the reference to the window object for the EPCMPROXY.subscribeEvent() method.

Restrictions

Restrictions for the EPCFPROXY object.

·        Following APIs are available for the EPCMPROXY object:

¡        System API

¡        Event API

¡        Client data Bag API

¡        WorkProtect and Cross Navigation API

·        The EPCMPROXYobject delegates the calls up one level. If your portal application uses additional Framesets or IFrames, the calls inside the subframes are not processed.

·        To avoid the JavaScript errors, encapsulate the EPCFPROXY calls with JavaScript try/catch statements.

·        The JavaScript file epcfproxy.js is not a part of the portal core. The file must be stored in the application code repository and delivered with the portal application.

End of Content Area