Você está na página 1de 14

Window Plugs: Startup and Exit

Use
Like Web Dynpro views, each Web Dynpro window has Inbound and Outbound Plugs . Any
number of these plugs can be defined as startup or exit plugs.
Startup Plug
The startup plug is a special inbound plug .
The Startup property, which you can define on the Inbound Plugs tab page in the window
editor, declares for the inbound plug the option to instantiate a component and to start a
new application. For this reason, a startup plug should be used only if it is also available to
the window interface.
Components can be accessed externally using any plug that is defined as a startup plug.
When you create a Web Dynpro application for this interface view, only those plugs defined
as startup plugs are available for the application. Since at least one inbound plug of a Web
Dynpro window must always be defined as a startup plug, you can find a startup plug with
the name DEFAULT on the Inbound Plugs tab page.
Exit Plug
The exit plug is a special outbound plug .
If a Web Dynpro window is closed by means of an exit plug, the associated application is
ended automatically. For this reason an exit plug can only be used if it is available to the
interface view of the window.
An exit plug always closes an application. This can happen in the following ways:

The application is closed.

The application and the browser window are closed.


You do this using the CLOSE_WINDOW function (parameter CLOSE_WINDOW).

The application is closed and the system navigates to another URL.

In the latter two cases the LOGOFF parameter is available (see below).

Caution

In a portal environment, the exit plug may be used only with the CLOSE_WINDOW parameter.
It is not permitted to navigate to another application by passing a URL.
Close and CLOSE_WINDOW Parameter
You can add parameter CLOSE_WINDOW of type WDY_BOOLEAN to an exit plug, and when the
plug is triggered you pass the value ABAP_TRUE, which the framework uses to close the
window.
You can use method GET_IS_CLOSE_WINDOW_SUPPORTED of interface IF_WD_APPLICATION to
query whether or not the prerequisites for using CLOSE_WINDOW are fulfilled.
You can find an example in the system in the Web Dynpro
application WDR_TEST_EXIT_WITH_CLOSE.

Caution
CLOSE_WINDOW overrides the WorkProtect mode in the portal, that is,
for CLOSE_WINDOW=TRUE there is noWorkProtect popup (for example, message: You have
unsaved data ).
More information : Restrictions in CLOSE WINDOW Functions
Close and URL Navigation
Exit plugs have the special property that they use the defined URL parameter. After you have
created the URLparameter in the parameter list on the Outbound Plugs tab page in the
window editor, you can specify a value for this parameter in the method that calls the exit
plug.
The parameter is optional; a value does not have to be defined for it.
In the following source code a windows exit plug is called by an event handler method in the
controller of an embedded view, and it specifies an external URL:
method ONACTIONGO_EXIT .
data: L_REF_MAIN_WINDOW type ref to IG_MAIN_WINDOW .
L_REF_MAIN_WINDOW =
WD_THIS->GET_MAIN_WINDOW_CTR( ).
L_REF_MAIN_WINDOW->FIRE_MY_EXIT_PLUG_PLG(
URL =
'http://www.sap.com' ).
endmethod.

An application that closes in this way closes the active component instance and goes to the
specified Web application.
You also can leave an application to go to a second application, without closing the first
application, but simply suspending it in order to return to it later.
More information : Suspend Calls .
Closing with the Logoff Parameter
You can pass the LOGOFF parameter to an exit plug. The security session is deleted in the
back end. With stand-alone cases the SS02 ticket is also deleted.

Hi Subathra,
If you just intend to close your application then you can ommit passing any parameters at all in your
exit method. So you would just create an outbound plug (say GO_EXIT), checkmark the "Interface"
checkbox & select the Plug Type as "Exit". Your parameters list will be completely empty i.e, no
URL/CLOSE_WINDOW.
Now go to the properties tab of your view & add the reference of your window controller to it. Next go
to the buttons up on pressing which you would want your window to be closed and place the
necessary coding inside it.
METHOD onactionclose_application . DATA: lr_ref TYPE REF TO ig_zuday_close_applicat.
lr_ref = wd_this->get_zuday_close_applicat_ctr( ). " Fire Exit Plug lr_ref->fire_go_exit_plg( ).
ENDMETHOD.

In the above code snippet I have few things like ig_zuday_close_applicat &
get_zuday_close_applicat_ctr. This is because the name of my application is
ZUDAY_CLOSE_APPLICAT. You should replace this with the corresponding names of your
component & then everything will just work fine.
Regards,
Uday
NOTE Now that you have defined some parameters for your outbound plug just remove these
parameters & then activate just the window alone. If you get any error try to do a activate anyway for
the window. Next remove the passage of parameters (URL & CLOSE_WINDOW) while firing the
outbound plug.

Aug 09 05

Using an Exit Plug in Web Dynpro for ABAP


By Er.Shitanshu Sahai, L&T Infotech

Introduction
We come across scenarios where we are required to open t-codes urls from our web dynpro screen. Now,
this article will help you to open another url on the same window by closing the parent window. Follow the
below mentioned steps to achieve the goal.
Step 1
Create a component as shown below.

Step 2

Name the window as ZEXAMPLE_W


Name the view as MAIN_V

Step 3
Create a button on the screen, name the action on the button as A_EXIT.

Click here to continue...


...Previous

Step 4
Define outbound and inbound plugs in the MAIN_V view as shown below.

Step 5

Go to window and define the outbound plug. Also provide a parameter which will be passed while
triggering this outbound plug.

Step 6
Go to the view (MAIN_V) and declare the window as a used component in the property tab of the view.

Click here to continue...


...Previous

Step 7
Now using the code wizard write down the following code in the action declared in the view i.e A_EXIT.

method ONACTIONA_EXIT .
DATA LO_ZEXAMPLE_W TYPE REF TO IG_ZEXAMPLE_W .
LO_ZEXAMPLE_W = WD_THIS->GET_ZEXAMPLE_W_CTR( ).
LO_ZEXAMPLE_W->FIRE_OUT_WINDOW_PLG(
URL = 'HTTP://WWW.GOOGLE.COM'
).

" string

endmethod.
Step 8
Create an application as shown below and test it. As I have passed the URL of Google, The same will be
opened in the same window after the parent window is closed.

Você também pode gostar