how to client side eventing with bw 3.x and ep 5.0

Upload: piedone64

Post on 03-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    1/13

    How to

    Client Side Eventing with BW3.x and EP 5.0

    Applicable Releases: BW 3.x

    March 2003

    SAP (SAP America, Inc. and SAP AG) assumes no responsibility for errors or omissions in these materials.

    These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, theimplied warranties of merchantability, fitness for a particular purpose, or non-infringement.

    SAP shall not be liable for damages of any kind including without l imitation direct, special, indirect, or consequential damagesthat may result from the use of these materials.

    SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained withinthese materials. SAP has no control over the information that you may access through the use of hot links contained in thesematerials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third partyweb pages.

    mySAP BI How-To papers are intended to simplify the product implementation. While specific product features andprocedures typically are explained in a practical business context, it is not implied that those features and procedures are theonly approach in solving a specific business problem using mySAP BI. Should you wish to receive additional information,clarification or support, please refer to SAP Professional Services (Consulting/Remote Consulting).

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    2/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    Table of Contents

    HOW TO ........................................................................................................................................... 1CLIENT SIDE EVENTING WITH BW 3.X AND EP 5.0 .......................................................................11 BUSINESS SCENARIO................................................................................................................ 12 SOLUTION.................................................................................................................................... 23 THE STEP-BY-STEP SOLUTION ................................................................................................ 4APPENDIX ........................................................................................................................................... 73.1 Example Code of the Sender iView.......................................................................................................73.2 Example Code of the Receiver iView....................................................................................................83.3 Second Example Code for Sender iView..............................................................................................93.4 Second Example Code for Receiver iView .........................................................................................103.5 BW-Items and Portal-Eventing...........................................................................................................113.6 Useful Links ..........................................................................................................................................11

    2003SAP AG TABLE OF CONTENTS

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    3/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    1 Business Scenario

    You have several BW iViews in a Portal page and you want them to communicate

    with each other. In the scenario further down we have an iView ABC Selectionwhich allows us to choose ABC Classification based either on materials or onvendors. We want it to influence the remaining iViews.

    2003 SAP AG 1

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    4/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    2 Solution

    The Portal provides a framework for clientside eventing.

    Enterprise Portal Client Framework (EPCF)

    A service in the Portal, that enhances your Portal Components output withJavaScript. It also simplifies the client side programming of Web Components. TheClient Framework is accessible in embedded as well as in isolated iViews.

    Enterprise Portal Client Manager (EPCM)

    EPCM is the client side component that resides in a Portal page and provides theservice of the EPCF.

    The functions of the Client Framework API are defined as methods of a globalJavaScript object called EPCM. All public framework methods are used as follows:

    EPCM.[API_method_name]( [Params]* );

    2003 SAP AG 2

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    5/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    The Client Framework consists of the following groups:

    System Function

    This includes interfaces that provide methods for obtaining important systeminformation (such as the version or the level of the framework).

    Client Eventing

    Client Eventing makes it possible for iViews to communicate with each otheron the client side and also to communicate with the Portal itself.

    Client Data Bag

    The Client Data Bag is a client-based memory that stores JavaScript dataduring a portal session. It distributes data and objects on client-basedcomponents that are linked with a browser session by pairs of key values.

    For each BW Iview running in Portal the JavaScript-Library epcfproxy.js willbe added to the HTML-Coding. In this JavaScript-Library all relevant functions

    for Client eventing in Portal are included. Those Java-Script-Functions can beaccessed via EPCMPROXY.functionname. The EPCMPROXY objectencapsulates BW specifics for Iview eventing.

    The Sender BW-IView will raise an Event, as soon the Drop-Down-Box haschanged. The Receiver-Iviews will catch the event and act on it by changing aWeb-Item Attribute with Command-URLs.

    2003 SAP AG 3

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    6/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    3 The Step-By-Step Solution

    1. Sender iView (event producer)

    Create a Sender iView, which serves asevent sender and insert it into your Portalpage.

    Create a BEx Web Application and save itas iView. Import the new iView in yourPortal. Assign the iView to the Portal page.

    Via the HTML View in the Web ApplicationDesigner you have to add the followingcoding (on the right hand side) to the WebTemplate.

    2. Selection

    If you choose a new option in the selectboxthe raiseEvent function is called.

    value will be replaced automatically by theactual value a user chooses via the dropdown function: "PMC_ABC_L" or"PMC_ABC_M"

    ABC Classification Vendors

    ABC Classification Material

    2003 SAP AG 4

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    7/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    This function raises an event. Via the eventthe value is distributed to all subscribers.

    Parameters of EPCMPROXY.raiseEvent:

    namespace: unique event name-space an URN (i.e. your reserved

    domain name in reverse order e.g.com.sap:BWEvents)

    eventName: the event name, e.g.BWSetABCClassification

    dataObject : a data object (String,Number, Boolean or Object) withinformation describing the event

    sourceId: The component ID of theevent source (for example, the IDdefined by the Design Time) or nullif the parameter has been omitted.

    Result:

    The Portal framework will call all eventhandlers which are registered for this eventand passes an event object as a singlevalue to the event handler.

    3. Receiver iView

    Create a BEx Web Application and save itas iView. Import the new iView in yourEntreprise Portal. Assign the iView to thePortal page.Via the HTML View in the Web ApplicationDesigner you have to add the followingcoding (on the right hand side) to the WebTemplate.

    2003 SAP AG 5

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    8/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    4. Listen for events

    To register the iView as listener for eventsyou add an event handler into your webtemplate. Therefore you have to add theEPCMPROXY.subcribeEvent function in the

    head of your HTML page.Parameters ofEPCMPROXY.subscribeEvent:

    namespace: unique event name-space an an URN (i.e. yourreserved domain name in reverseorder e.g. com.sap:BWEvents)

    eventName: the event name, e.g.BWSetABCClassification

    window reference to which theevent is sent. The window must

    implement the specified eventHandler. Here the current window isspecified. (iframe of BEx Web

    Application running in the Portal)

    eventHandler: Name of theeventHandler function

    If the registered event takes place, theeventHandler function is called with theparametereventObj. Within thiseventHandler the attribute ABC_NAME ofitem ABCANALYSIS_1 is changed to the

    new value. Because the functionmyreceiveEvent is called from outside(Portal) the BW URL has to be fully qualified(location.protocol and location.host).

    Result: The iView will be refreshed

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

    function myreceiveEvent( eventObj ) {

    var url = location.protocol "//"+location.host+SAP_BW_URL_Get()url = url + "&ITEM=ABCANALYSIS_1&ABC_NAME=" +eventObj.dataObject;

    SAPBWOpenURL(url);

    }

    2003 SAP AG 6

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    9/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    Appendix

    3.1 Example Code of the Sender iView

    TEMPLATE PROPERTIES

    BW Web Application

    ABC Classification Vendors ABC Classification Material

    2003 SAP AG 7

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    10/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    3.2 Example Code of the Receiver iView

    TEMPLATE PROPERTIES

    BW Web Application

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

    function myreceiveEvent( eventObj ) {

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

    "&ITEM=ABCANALYSIS_1&ABC_NAME=" + eventObj.dataObject;SAPBWOpenURL(url);

    }

    ITEM: ABCANALYSIS_1

    2003 SAP AG 8

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    11/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    3.3 Second Example Code for Sender iView

    Within the second example a user can select a material value from a Drop-Down-Box. This value willbe sent to the receiver iView, where the DataProvider will be filtered accordingly.

    The Drop-Down-Box is filled by the BW system, using the Web Item Drop-Down-Box with theattribute only_values=X and an own javascript function for the onchange event.

    DATA_PROVIDER: DATAPROVIDER_1

    TEMPLATE PROPERTIES

    BW Web Application

    ITEM: DROPDOWNBOX_1

    2003 SAP AG 9

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    12/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    3.4 Second Example Code for Receiver iView

    In this Example a filter command will be sent to the BW system on receiving the eventBWSetMaterialFilterEvent. DataProvider_1 will be filtered according to the material choosen in the

    Drop Down Box of the Sender iView.

    DATA_PROVIDER: DATAPROVIDER_1

    TEMPLATE PROPERTIES

    BW Web Application

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

    function myreceiveEvent( eventObj ) {var url = location.protocol +"//"+location.host+SAP_BW_URL_Get();

    url = url + "&data_provider=*&multi=X&FILTER_IOBJNM=0D_MATERIAL&FILTER_VALUE="+eventObj.dataObject+"&filter_collapse=";

    SAPBWOpenURL(url);

    }

    ITEM: TABLE_1

    2003 SAP AG 10

  • 7/28/2019 How to Client Side Eventing With BW 3.x and EP 5.0

    13/13

    HOW TO CLIENT SIDE EVENTING WITH BW AND EP

    3.5 BW-Items and Portal-Eventing

    The following table gives a short overview how Portal Eventing can be integratedwithin BW Web Items, besides the using of stand-alone HTML-Coding within yourWeb Application.

    Web-Item How to integrate

    Drop-Down-Box Use Parameter only_values=X and create your own select-Tag with onchange-JavaScript-Event

    Radio-Button Parameter only_values=X and create your own form withaction

    Table Table-Interface (run JavaScript function for eventraisingdirectly on click, add icon to raise event); Enhance contextmenu

    Chart; Map; Label Enhance context menuNavigation Block Table-Interface (run JavaScript function for eventraising

    directly on click, add icon to raise event); Enhance contextmenu

    3.6 Useful Links

    How-To-Guide Cient-Side-Eventing

    http://service.sap.com/~sapidb/011000358700000590732003E/RIG_Call.zip How-To-Guide Enhance the Context Menu in Web Applicationshttp://service.sap.com/~sapidb/011000358700002337242002E/HOWTOENHANCECONTEXTMENU.PDF

    How-To-Guide Enhance your Web-Query with the Table-Interfacehttp://service.sap.com/~sapidb/011000358700003242362001E/HOWTOTABLEINTERFACE.DOC

    Online Help BEx Web-Applications

    http://help.sap.com Business Information Warehouse Business Explorer WebApplication Design

    2003 SAP AG 11

    http://service.sap.com/~sapidb/011000358700000590732003E/RIG_Call.ziphttp://service.sap.com/~sapidb/011000358700002337242002E/HOWTOENHANCECONTEXTMENU.PDFhttp://service.sap.com/~sapidb/011000358700002337242002E/HOWTOENHANCECONTEXTMENU.PDFhttp://service.sap.com/~sapidb/011000358700003242362001E/HOWTOTABLEINTERFACE.DOChttp://service.sap.com/~sapidb/011000358700003242362001E/HOWTOTABLEINTERFACE.DOChttp://help.sap.com/http://help.sap.com/http://service.sap.com/~sapidb/011000358700003242362001E/HOWTOTABLEINTERFACE.DOChttp://service.sap.com/~sapidb/011000358700003242362001E/HOWTOTABLEINTERFACE.DOChttp://service.sap.com/~sapidb/011000358700002337242002E/HOWTOENHANCECONTEXTMENU.PDFhttp://service.sap.com/~sapidb/011000358700002337242002E/HOWTOENHANCECONTEXTMENU.PDFhttp://service.sap.com/~sapidb/011000358700000590732003E/RIG_Call.zip