By the end of this lesson, you will be able to understand navigation techniques between two different views.Before going to this lesson, keep below thing in mind.
- We can create multiple views in a web dynpro component.
- If we need to display a view, it must be embedded into a window, without a window we cannot display view.
Web Dynpro Plugs:
As a part of real-time business applications, we need to navigate from one screen to another, for this one there is a concept of plugs in web dynpro ABAP.Plugs is a concept which is used to navigate from one view to another view. There are two types of plugs available in web dynpro ABAP.
What ate outbound and inbound plugs?
|Outbound Plugs||Inbound Plugs|
|This plug is used to exit a view.||This plug is used to enter into a view.|
|Every outbound plug must linked to a inbound plug.||Every inbound plug must be linked to a outbound plug.|
For every outbound plug a method by name FIRE_
||For every inbound plug a event handler method will be created by name HANDLE_
|Just fire the out bound plug method to navigate.
||This plug event handler method will be automatically trigger whenever we enter into a view.|
Example component of using view navigation
Step1: Go to SE80, create a web dynpro component ZSAPN_VIEW_PLUGS.
Step2: Go to main view, insert a button, provide button text as 'Next', and create action method for button ON_NEXT.
Step3: Right click on component -> create -> view, provide name as SECOND and enter.
Step3: Go to SECOND view, insert a button, provide button text as 'Previous', create action method for button ON_PREVIOUS.
Step5: Go to main view, outbound plugs tab, add outbound plug as GOTO_SECOND and inbound plugs tab add inbound plug as IN_MAIN.
Step6: Go to SECOND view, outbound plugs tab, add outbound plug as GOTO_MAIN and inbound plugs tab add inbound plug as IN_SECOND.
Step7: Expand window, drag and drop MAIN, SECOND view into window.
Step8: Expand two views, right click on GOTO_SECOND -> Create Navigation Link, press F4, select destination view as SECOND and enter.
Step9: Right click on GOTO_MAIN -> Create Navigation Link, press F4, select destination view as MAIN and enter.
Step10: Go to main view actions tab, double click on ON_NEXT method and add below code. wd_this->FIRE_GOTO_SECOND_PLG( );
Step11: Go to SECOND view actions tab, double click on ON_PREVIOUS method and add below code. wd_this->FIRE_GOTO_MAIN_PLG( );
Step12: Save and activate the component.
Step13: Test the component.