Start of Content Area

Background documentation Triggering a Portal Event  Locate the document in its SAP Library structure

A portal event is an event that is triggered within an iView – in this case, within a Web Dynpro application – and is then passed by the portal to one or several other iViews. The portal passes the event to all iViews that have registered for this event. In this way, events can be transported between several iViews based on different development techniques.

Note 

Portal eventing functions between iViews that are on the same browser window.

iViews can also open new browser windows using JavaScript. The new browser window is then the subordinate window and the iView browser window is the superordinate window.

Events can be transferred from an iView in a subordinate browser window to iViews in all superordinate browser windows.

Events cannot be transferred from a superordinate browser window to a subordinate browser window.

All participating events must also belong to the same domain. Otherwise portal eventing cannot work due to JavaScript restrictions.

In Web Dynpro ABAP, the Portal-Manager (interface IF_WD_PORTAL_INTEGRATION) provides the FIRE method. Using the Web Dynpro Code Wizard, you can insert this method call as a template into your source code and fill it with values in accordance with the requirements of your application.

method ONACTIONFIRE_PORTAL_EVENT .

.

.

.

data: L_API_COMPONENT  type ref to IF_WD_COMPONENT,

        L_PORTAL_MANAGER type ref to IF_WD_PORTAL_INTEGRATION.

 

  L_API_COMPONENT = WD_COMP_CONTROLLER->WD_GET_API( ).

  L_PORTAL_MANAGER = L_API_COMPONENT->GET_PORTAL_MANAGER( ).

 

  L_PORTAL_MANAGER->FIRE(

        PORTAL_EVENT_NAMESPACE = 'my_namespace_for_Web_Dynpro_documentation'

        PORTAL_EVENT_NAME      = 'showCustomer'

        PORTAL_EVENT_PARAMETER = CUSTOM_ID )
        PORTAL_EVENT_SCOPE     =
        IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CURRENT_WINDOW ).

 

endmethod.

 

 

 

In addition to the mandatory parameters Namespace and Name, you can also pass on another parameter and a scope:

Namespace where the event is stored

’PORTAL_EVENT_NAMESPACE’

Name of the event

’PORTAL_EVENT_NAME’

Parameter

’PORTAL_EVENT_PARAMETER’

Scope

PORTAL_EVENT_SCOPE

 

You can use the scope to determine which browser window the event is forwarded to:

IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CURRENT_WINDOW

Event is only forwarded within the current browser window

IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CHILD_TO_PARENTS

Event is forwarded to all superordinate browser windows but not within the current browser window

IF_WD_PORTAL_INTEGRATION=>CO_EVENT_SCOPE-CURRENT_WINDOW_AND_PARENTS

Event is forwarded to all superordinate browser windows and within the current browser window

 

You can trigger such a portal event from anywhere in your Web Dynpro application. The event is sent with the next response to the client. You can even trigger several portal events in one request-response cycle.

However, it is usual to trigger a portal event in an action handler of a Web Dynpro application. This could be the case, for example, with an action handler of a UI element (for example, a button). When a portal event is triggered, an internal application event is first passed from the iView to the portal and can e handled within one or several other iViews.

Syntax for Namespace and Names of Events

The characters permitted for the namespace and event name are restricted to the namespaces of the SAP Enterprise Portal – Client Framework.

You can only use the characters listed in the table below.

Valid Characters

Uppercase letters

"A" - "Z"

Lowercase letters

"a" - "z"

Numbers

"0" - "9"

Special characters

"-" "_"  "."

Also note the following:

      The namespace must begin with the character string urn:

      The namespaces com.sapportals.portal.* and com.sapportals.* are reserved for SAP, and therefore you should not use them for your applications.

      Note that the namespace and the name are both case-sensitive.

Example urn:com.sap.webdynpro.testApplications.testEvent

Example

      You can find examples in the Web Dynpro applications in the system: WDR_TEST_PORTAL_EVENT_FIRE

Trigger event

      WDR_TEST_PORTAL_EVENT_FIRE2

This application serves as a test application. You can enter the name of an event from your own application in order to test the event separately.

 

 

 

 

End of Content Area