Show TOC Start of Content Area

Function documentation Eventing in the Portal  Locate the document in its SAP Library structure

Use

Portal eventing enables the exchange of information between various iViews for a portal page using JavaScript. The contents of the iView in which the event was triggered remain visible. Sending portal events to other portal pages or iViews outside of the current portal page is not possible. You can use navigation in the portal for this type of information exchange.

A BEx Web Application can be both the source and the target of an event. Authors can exchange user-defined events between BEx Web Applications. Some applications in the portal (such as Manager Self Service (MSS)) send and receive their own events, which can also be send or received from BEx Web Applications. The author of a BEx Web Application is responsible for the implementation of the JavaScript for sending and receiving. Sending of a portal event can be displayed as a link or as an extension of the context menu.

For more information on portal eventing, see Event API.

Features

Eventing in the portal is part of the Enterprise Portal Client Framework (EPCF) and enables the exchange of information between iViews at runtime. The BEx Web Application iView is displayed as iFrame within the HTML page. Due to this nesting, the EPCM Proxy is used. With the EPCM proxy, the EPCM API function EPCM.subscribeEvent and EPCM.raiseEvent is used.

Process Flow

       1.      A BEx Web Application subscribes to a portal event using EPCMPROXY.subscribeEvent:

function EPCM.subscribeEvent (nameSpace, eventName, eventHandler)

In the subscription, the name of a JavaScript function eventHandler that is to be called when receiving the portal event is transferred.

       2.      Another BEx Web Application or another application sends a portal event using the EPCMPROXY.raiseEvent:

function EPCM.raiseEvent(nameSpace, eventName, dataObject [, sourceId])

       3.      When the portal event is triggered, the subscribed JavaScript function eventHandler is called.

Multiple Web items (for example Filter, Dropdown Box, and so on) only have the attribute ONLY_VALUES, so that they only receive the values. With the values it is possible to implement your own form routines. These form routines can send a portal event using EPCM.raiseEvent during submit.

For more information about the Web items available, see Web Items.

Note

At the moment, there is no directory of all portal events from SAP. You can use the Web browser to display the HTML source text for a portal page. When you search for raiseEvent, you can determine the nameSpace and the eventName of a portal event.

Examples

Caution

After copying the examples of the Web templates, replace the special quotation marks (such as „abc“) with normal quotation marks (such as “abc”).

Example of a Web Template That Sends Portal Events

<HTML>

<!-- BW data source object tags -->

<object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="SET_DATA_PROVIDER"/>

         <param name="NAME" value="DATAPROVIDER_1"/>

         <param name="QUERY" value="T_PDEBW3_Q_SOLD_TO_MATERIAL"/>

         <param name="INFOCUBE" value="0D_DECU"/>

         DATA_PROVIDER:             DATAPROVIDER_1

</object>

 

<object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="SET_PROPERTIES"/>

         <param name="TEMPLATE_ID" value="T_PDEBW3_T_EVENTING_SOURCE"/>

         TEMPLATE PROPERTIES

</object>

 

<HEAD>

<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">

<TITLE>BW Web Application</TITLE>

      <link href="/sap/bw/Mime/BEx/StyleSheets/BWReports.css" type="text/css" rel="stylesheet"/>

</HEAD>

<script language="javascript">

<!--

function dataContainer(dim, value) {

  this.dim = dim;

  this.value = value;

}

 function raiseEvent(dim, value) {

        var data = new dataContainer( dim, value );

        EPCMPROXY.raiseEvent( "urn:com.sap:BWEvents","BWFilter", data, null );

   }

-->

</script><BODY>

<TABLE cellSpacing=1 cellPadding=1 width="90%" border=0>

 

  <TR>

    <TD vAlign=top><STRONG>All</STRONG></TD>

    <TD vAlign=top><STRONG>Sold to</STRONG> </TD>

    <TD vAlign=top><STRONG>Material</STRONG></TD></TR>

  <TR>

    <TD vAlign=top width="30%"><A href="Javascript:raiseEvent('', '');">Reset</A></TD>

    <TD vAlign=top width="30%"><A href="Javascript:raiseEvent('0D_SOLD_TO', '0000001050');">Becker

      Berlin</A></TD>

    <TD vAlign=top width="40%">

<form name="myform">

<select name="myselect" size="1" onchange="Javascript:raiseEvent('0D_MATERIAL', document.myform.myselect.options[document.myform.myselect.selectedIndex].value);">

<object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="GET_ITEM"/>

         <param name="NAME" value="DROPDOWNBOX_1"/>

         <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_FILTER_DDOWN"/>

         <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>

         <param name="GENERATE_CAPTION" value=""/>

         <param name="IOBJNM" value="0D_MATERIAL"/>

         <param name="ONLY_VALUES" value="X"/>

         ITEM:            DROPDOWNBOX_1

</object>

</select>

</form>

</TD></TR></TABLE>

</BODY>

</HTML>

Example of a BEx Web Application That Receives the Above Portal Events

<HTML>

<!-- BW data source object tags -->

<object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="SET_DATA_PROVIDER"/>

         <param name="NAME" value="DATAPROVIDER_1"/>

         <param name="QUERY" value="T_PDEBW3_Q_SOLD_TO_MATERIAL"/>

         <param name="INFOCUBE" value="0D_DECU"/>

         DATA_PROVIDER:             DATAPROVIDER_1

</object>

 

<object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="SET_PROPERTIES"/>

         <param name="TEMPLATE_ID" value="T_PDEBW3_T_EVENTING_TARGET"/>

         TEMPLATE PROPERTIES

</object>

 

<HEAD>

<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">

<TITLE>BW Web Application</TITLE>

      <link href="/sap/bw/Mime/BEx/StyleSheets/BWReports.css" type="text/css" rel="stylesheet"/>

</HEAD>

<script language="Javascript">

    EPCMPROXY.subscribeEvent( "urn:com.sap:BWEvents",  "BWFilter", window, "myreceiveEvent");

    function myreceiveEvent( eventObj ) {

       if( eventObj.dataObject.value == "" ) {

           var url = location.protocol  + "//" + location.host + SAP_BW_URL_Get();

           // remove filter

           //url = url + "&CMD=REMOVE_FILTER&IOBJNM=" + eventObj.dataObject.dim + "&DATA_PROVIDER=*&MULTI=X";

           // reset

           url = url + "&CMD=RESET&DATA_PROVIDER=*&MULTI=X";

        }

        else {

           var url = location.protocol  + "//" + location.host + SAP_BW_URL_Get();

           url = url + "&FILTER_IOBJNM=" + eventObj.dataObject.dim +  "&FILTER_VALUE=" + eventObj.dataObject.value + "&DATA_PROVIDER=*&MULTI=X";

        }

        SAPBWOpenURL(url);

    }

</script>

<BODY>

<P><object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="GET_ITEM"/>

         <param name="NAME" value="NAVIGATIONBLOCK_1"/>

         <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_NAV_BLOCK"/>

         <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>

         ITEM:            NAVIGATIONBLOCK_1

</object></P>

<P><object>

         <param name="OWNER" value="SAP_BW"/>

         <param name="CMD" value="GET_ITEM"/>

         <param name="NAME" value="TABLE_1"/>

         <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>

         <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>

         ITEM:            TABLE_1

</object></P>

</BODY>

</HTML>

Example of a Web Template That Subscribes to and Receives a Portal Event from the SAP HCM Manager Self Service (MSS)

<script language="javascript">

   var dim = "HEMPLOYEE";

    // Subscribe Event

    if( check_for_sap_ep() == true ) {

      EPCMPROXY.subscribeEvent( "urn:com.sap.pct.hcm.orgmanagement:CurrentObject",  "objectChanged", window, "myreceiveEvent");

    }

    function myreceiveEvent( eventObj ) {

       if( eventObj.dataObject.length > 14 ) {

          var value = sourceSystem + eventObj.dataObject.substring( 6, 14 );

          var url = location.protocol  + "//" + location.host + SAP_BW_URL_Get();

          url = url + "&FILTER_IOBJNM=" + dim +  "&FILTER_VALUE=" + value + "&DATA_PROVIDER=*&MULTI=X";

          SAPBWOpenURL(url);

        }

    }

</script>

 

End of Content Area