The below is the simple example of using view plugs in web dynpro for ABAP, hope you understand the concept of plugs in web dynpro abap
Step1: Go to SE80, create a web dynpro component ZSAPN_VIEW_PLUGS.
Go to SE80, select web dynpro component from drop down, provide name as ZSAPN_VIEW_PLUGS and press enter.
Click on yes, provide description, continue(enter) and save it in a local object.
Step2: Go to main view, insert a button
Go to change mode, expand views, double click on main view and right click on ROOTUIELEMENTCONTAINER -> Insert element.
A popup will come, provide id as BT1 and type as button and enter.
Select button ui element, provide text, create action method under events, a popup will code, provide action and description and enter.
Step3: Create another view
Right click on view -> create
A popup will come, provide name, description and enter.
Save the component immediately(then only we can see second view).
Go to second view and insert button
Go to (double click) second view and right click on ROOTUIELEMENTCONTAINER -> insert element.
A popup will come, provide id as BT2, type as button and enter.
Select button, provide text, click on create under events, provide action and description and enter.
Step4: Add inbound and outbound plugs
Go to main view, go to outbound plugs tab and add a plug as below.
Go to main view, go to inbound plugs tab and add a plug as below.
Repeat the same steps in SECOND view by adding plug names as IN_SECOND (inbound plug) and GOTO_MAIN (outbound plug).
Create navigation link
To use a view, we must embed it into a window(with out window we can not display a view), go to window(double click), drag and drop SECOND view onto window.
Navigation link is a link between outbound and inbound plug, through which an outbound plug will identify the destination(target view).
Expand main view and right click on outbound plug -> create navigation link .
Press F4 , select second view and enter .
Similarly create navigation link for outbound plug of second view right click on GOTO_MAIN -> create navigation link, popup opens press F4, select MAIN and enter.
Step5: Fire outbound plg
When we call an outbound plug, we call that process as firing of outbound plug.
Go to main view, go to actions tab, double click on ON_BT1 method, click on code wizard, fire outbound plg.
The below code will be generated.
Similarly go to SECOND view, actions, double click on ON_BT2 method and fire outbound plug (GOTO_MAIN).
below code will be generated.
Step6: Create application and test
Save and activate the web dynpro component, right click on component name create -> web dynpro application, provide a name, enter save it in a local object.
Right click on application -> test.
Browser will open, click on go to second view, it will go to second view and click on go to previous view, it will go to main view.