Triggering a Portal Event - SAP ABAP Web Dynpro

Web Dynpro through the Portal – Manager offers some methods to be used to trigger events and to react to portal events. To do this,we can use the methods of the IF_WD_PORTAL_INTEGRATIONinterface,as follows:

  • FIRE – Trigger portal event;
  • SUBSCRIBE_EVENT – Register portal event;
  • UNSUBSCRIBE_EVENT – Delete portal event registration.

For the scope of this example,we re-create our firstly created component; but,in this case, we enter the name in the Web Dynpro component that triggers the portal event and we display the greeting in the second Web Dynpro component that reacts to the portal event.

The Portal Eventing concept is appropriate for communication between applications created by using different technologies.But, through this example, we will create the application that triggers the portal eventing and the application that react to the portal event by using the same technology,

Web Dynpro ABAP.Our purpose is to present the both cases and, depending on the requirements, to choose one of the variants (trigger or receiver)in combination with an application developed into another technology(Web Dynpro Java, Visual Composer, etc.).

Processing portal events

We start with the creation of the Web Dynpro component able to trigger a portal event by using the FIRE method. The structure of this component and the view layout are presented.

Web Dynpro component structure and view layout

In the context view,we have created an attribute named “NAME”, of STRING type.When the user presses the “Event trigger” button, we use the FIRE method to trigger a portal event that will be subsequently passed by the portal to the second iView that has been registered for this event,respective to the second Web Dynpro ABAP application. In this way,the events can be transported between the iViews (Web Dynpro applications or applications that use other technologies).

Listing shows the coding of the onactionevent_trigger event handler method.As we can see,after passing the value of the context attribute into the local variable LV_NAME,we use the FIRE method of the IF_WD_PORTAL_INTEGRATI

onactionevent_trigger event handler method

METHOD onactionevent_trigger .
DATA lv_name TYPE string.
name = `NAME`
value = lv_name).
DATA: lr_api_component TYPE REF TO if_wd_component,
lr_portal_manager TYPE REF TO if_wd_portal_integration.
lr_api_component = wd_comp_controller->wd_get_api( ).
lr_portal_manager = lr_api_component->get_portal_manager( ).
lr_portal_manager->fire(portal_event_namespace = 'sap.example
portal_event_name = 'person_name'
portal_event_parameter = lv_name).

interface to fire the portal event with the name “person_name”. This method has three importing parameters of STRING type:

  • PORTAL_EVENT_NAMESPACE – namespace in which the event is stored;
  • PORTAL_EVENT_NAME – name of the event;

These values have to match with the event receiver application. Web Dynpro Wizard offers the required support to work with portal events.

Web Dynpro Wizard and portal manager

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

SAP ABAP Web Dynpro Topics