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.
Portal eventing functions only between iViews that are on the same browser window. Events between iViews in different browser windows cannot be transported.
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 ).
endmethod.
|
In addition to the mandatory parameters Namespace and Name, you can also pass on another parameter:
Namespace in which the event is stored | ’PORTAL_EVENT_NAMESPACE’ |
Name of the event | ’PORTAL_EVENT_NAME’ |
Parameter | ’PORTAL_EVENT_PARAMETER’ |
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 character | "-" "_" "." |
Also note that:
· The namespace must begin with the character string urn:
· 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 case-sensitive.
urn:com.sap.webdynpro.testApplications.testEvent
Example
· You can find examples in the system under the Web Dynpro applications: 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.
No comments:
Post a Comment