Entering content frame

Procedure documentation Creating the SendEmail Action Locate the document in its SAP Library structure

To trigger sending the email message from the EmailFormView view using the Web service, you need an associated Action. Events belonging to UI elements on the client side – such as the onAction event of a button – can then be bound to this action. If a corresponding event handler is assigned to this action, you can react to the triggering event (clicking a button) of this action in the user interface. You do this by implementing this event handler in the view controller. In this way, actions represent a link between events on the client side and event handlers on the server side.

Prerequisites

·         The structure of your project WebDynpro_EmailWS is currently displayed in the Web Dynpro Explorer.

Procedure

Creating the Go Action

       1.      Open the View Designer for the EmailFormView view.

       2.      Choose the Actions tab.

       3.      Choose the New pushbutton to start the dialog box for defining a new action.

       4.      Enter the name SendEmail for the new action.

       5.      Enter Send Email in the Text field, then choose Finish.

Note

At runtime, the entry is automatically displayed in the field Text on the button (UI element) after its onAction event is bound to the SendEmail action.

After you have defined the new action named SendEmail, a corresponding event handler named onActionSendEmail() is automatically created in the view controller class EmailFormView.java. The actions defined for a view are listed in the View Designer on the Actions tab.

This graphic is explained in the accompanying text

       6.      Then switch to the Implementation tab. In this way, the Java classes belonging to the view controller are regenerated. The User Coding Areas that are accessible to you as the application developer are actually implemented in the class EmailForm.java, which has now been extended to include the event handler onActionSendEmail.

This graphic is explained in the accompanying text

Result

In this step, you created the SendEmail action for the EMailFormView view. You can now bind this to the corresponding button as an attribute of the onAction event, which you will do in the next step. At runtime, the onActionSendEMail event handler is then called after you have clicked the button for sending the e-mail message in the view controller.

Next step:

Designing a View Layout

 

Leaving content frame