ABAP Development: HowTo handle frontend events
The Visual business frontend component will fire events to be handled in the backend in order to allow the application to react on user actions. The central place which receives all events first is the control adapter. It decodes the event data which is transferred as a XML document and triggers the followup processes. The event data consists of two major parts:
- the event it self with source object information and related data and
- all data changes that happened on the frontend until the event was raised.
In cases changed data was submitted with the event those changes get published with event DATA_CHANGED of the control adapter IF_VBI_CONTROL_ADAPTER. This event needs to handled by the application in order to accept the changes on the backend. Changes are kept on the frontend (and get re-send) until a new object state is provided from the backend. The latter happens automatically when you update an object in the scene manager.
- the control adapter raises event CONTROL_EVENT with the event data
- this event is handled by the application class passing the event on to the service provider method IF_VBI_SERVICE_PROVIDER~HANDLE_SCENE_EVENT first
- in case the service provider does not confirm the handling (by setting CV_EVENT_HANDLED = ABAP_TRUE) the application class call one of its sub-event handlers:
- if the sub-handler does not confirm the handling the event is passed on further by raising event APPLICATION_EVENT. This event is handled intended to be handled by the surrounding UI technology, WDA or FPM, and to be published further in the technology specific format, e.g. as WDA event of the component controller or as FPM event.
UI independent event handling
- Object Select / Deselect
- Object delete
- Display Scene
- Clear Scene
Native WebDynpro application
- APPLICATION_LOADED - fired after the initialization of the Visual Business frontend control. At this event you may add an initial set of object to the map.
- CONTEXT_MENU_REQUEST - fired when the user request a context menu (via right mouse click)
- DETAIL_REQUEST - fired when the user requests a detail window for an object (via double click).
- DROP - fired when the user drags an object to another compatible object and drops it there.
- FCODE_SELECT - fired if the user selects an entry from a context menu or press a link / button on the detail window.
Most of the events have parameters, which provide further details on the event.