Quantcast
Channel: Web Dynpro ABAP
Viewing all articles
Browse latest Browse all 141

Raising the event from one view and handling the same event in another view .

$
0
0

Please find the list of step need to perform to achieve the handling of event from source view to target view .

 

Step 1 . Identify the source view from where the event will be triggered.

 

Step 2 . Identify the target view where the event should be handled.

 

Step 3 . Register the listener name, handle name , controller and event name in the targeted view .

               ·         Listener name – name of the view where even will be handled.

               ·        Handler name – the method in the target view which will handle the event raised in source view

               ·         Controller name – Name of the component controller used.

               ·         Event name – Name of the event which is raised.

1.png

Sample code for target view written in DOINIT method .

 

DATA: lo_componentcontroller     TYPE REF TO ig_componentcontroller,

          lo_api_componentcontroller TYPE REF TO if_wd_component.

 

       lo_api_componentcontroller->add_event_handler(

        listener_name    = 'V_MAIN'

        handler_name     = 'OK_HANDLE_MAIN'

        controller_name  = 'COMPONENTCONTROLLER'

        event_name       = 'OK_CLICKED_MAIN' ).

 

Step 4 .  you want the target view to handle the source view event just raise the event which is declared in component controller like below :

wd_comp_controller->fire_ok_clicked_main_evt( ) .

1.png

 

 

Resultant :  Now  once the ok_clicked_main event is raised from source view , the same event can be handled in the target view method OK_HANDLE_MAIN . You can perform any action/population in this method .


Viewing all articles
Browse latest Browse all 141

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>