Show TOC Start of Content Area

Procedure documentation Creating Actions and Implementing Navigation  Locate the document in its SAP Library structure

To navigate from one view to the next, you need an appropriate action, which you bind to a UI element event (such as a button’s event onAction ). You then need to implement the event handler, which reacts to this action and triggers a view change by calling an outbound plug.

Procedure

       1.      To navigate to the view editor for the first view, double-click the WelcomeCompView in the graphical tool or the corresponding node in project structure.

       2.      Choose the Actions tab.

       3.      Choose the New... pushbutton.

You can create a new action in the wizard that appears.

       4.      Enter the name Go for this new action. In the field Text enter Go for the text to be displayed on all UI-elements with events bound to this action. Leave the Event Handler option unchanged. Assign the plug Out as a Fire Plug and choose Finish.

This graphic is explained in the accompanying text

The new action, Go, and its associated event handler onActionGo are displayed in the list of actions.

This graphic is explained in the accompanying text

Result

You have created the Go action. The implementation of the navigation is automatically inserted into the associated event handler.

To check the generated source code for event handler onActionGo(), open the Java Editor for the WelcomeCompView.java class.

public void onActionGo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

  {

    //@@begin onActionGo(ServerEvent)

    wdThis.wdFirePlugOut();

    //@@end

  }

To trigger navigation from the WelcomeCompView to the ResultView using the outbound plug Out, the application calls the outbound plug method wdFirePlugOut(). The predefined private variable wdThis is used for this method call. The wdThis variable is always required whenever you make method calls to the view controller’s private interface IPrivate<Name_of_View>.

In a subsequent step, you must only assign these actions to the appropriate buttons in the view layout and the navigation part of your sample application will be completely defined.

End of Content Area