Tuesday, June 10, 2008

Web Dynpro ABAP Window Plugs: Startup and Exit

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 can be used only if it is also available to the window interface. Components can be accessed by external programs using plugs that were defined as startup plugs. So if you want to create a Web Dynpro application for this interface view, only plugs that can be flagged as startup plugs can be provided 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.

Caution

Exit plugs do not work in a portal environment.

CLOSE_WINDOW

When using an exit plug, you can pass the CLOSE_WINDOW parameter, which the framework uses to try and close the window in question.

Caution

Note that CLOSE_WINDOW is not supported for Firefox.

Note in addition that CLOSE_WINDOW is available only for portals based on NetWeaver 7.1.

You can use the method GET_IS_CLOSE_WINDOW_SUPPORTED of the interface IF_WD_APPLICATION to query whether or not the prerequisites for using CLOSE_WINDOW are fulfilled.

In the following source code, an exit plug for the window is called by an event handler method in the controller of an embedded view. It specifies an external URL and CLOSE_WINDOW:

method onactionto_exit .

data url type string.
data close_window type wdy_boolean.
data close_window2 type string.

wd_context->get_attribute( exporting name = 'ENTERED_URL' importing value = url ).
wd_context->get_attribute( exporting name = 'CLOSE_WINDOW' importing value = close_window ).

wd_this->fire_to_exit_plg( url = url close_window = close_window ).

endmethod.

You can find an example in the system in the Web Dynpro application WDR_TEST_EXIT_WITH_CLOSE.

URL Parameters

Exit plugs have the special property that they use the defined URL parameter. After you have created the URL parameter 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' " String

).

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, while not closing the first application, but suspending it in order to return to it later. For more information, see Suspend Calls in the section Advanced Concepts.

Inbound and Outbound Plug Parameters

As with all window plugs you can use startup and exit plugs with mandatory or optional parameters. These parameters must be of type string or TIHTTPNVP.

For more information, see Window: Inbound and Outbound Plug Parameters.

No comments:

Archive