Adding the Implementation of the Backend Connection

You have created the Search action for the SearchView.

You have constructed the view context for the two views, SearchView and ResultView, and mapped them to the custom controller context.

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


Implementing the action event handler


       1.      In the View Designer, choose the Implementation tab for the SearchView.

The Developer Studio runs several generation routines, and then displays the updated source code for the implementation of the view controller.

       2.      Insert the following line of code in the onActionSearch() method:


/** declared validating event handler */

public void onActionSearch( wdEvent )


  //@@begin onActionSearch(ServerEvent)

  // The event handler onActionSearch triggers the remote function call




Adding the implementation for the custom controller FlightListCust

In this procedure, you will add some lines of code to the implementation part of the custom controller. Do not worry, however, if the Java Editor indicates that some parts of the code contain errors. This issue will be resolved, at the latest when you generate the necessary imports statements in step 7.


1.       Open the Controller Editor for the custom controller FlightListCust again.

2.       Choose the Implementation tab.

3.       In the standard method wdDoInit(), between //@@begin wdDoInit() and //@@end, add the following lines of code:


  /** Hook method called to initialize controller. */

  public void wdDoInit()


    //@@begin wdDoInit()

    // Create a new element in the Bapi_Flight_Getlist_Input node

    Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();


    // Create new elements in the Destination_From and Destination_To nodes

    input.setDestination_From(new Bapisfldst());

    input.setDestination_To(new Bapisfldst());     



4.       If you simply copy and paste the above lines in the Java Editor, formatting may be lost. To format these lines according to the standard settings, choose  Source ® Format from the context menu of the Java Editor.

5.       In the method executeBapi_Flight_Getlist_Input(), between //@@begin executeBapi_Flight_Getlist_Input()and //@@end, add the following lines of code:

  /** declared method */

  public void executeBapi_Flight_Getlist_Input( ) {

    //@@begin executeBapi_Getlist_Input()



      // Calls remote function module BAPI_FLIGHT_GETLIST


    // Synchronise the data in the context with the data in the model



    catch (Exception ex)


      // If an exception is thrown, then the stack trace will be printed





6.       If you need to format these lines of code, choose the Format function once again from the context menu of the Java Editor.

7.       To add the import statements, position the cursor anywhere in the Java Editor and chooseSource ® Organize Imports from the context menu.

The following import statements are added to the source code, without your having to do anything more:

//@@begin imports






8.       Save the new metadata by choosing the icon  (Save All Metadata) from the toolbar.


The Developer Studio updates and compiles your project sources. (Note: Compilation only occurs if you are using the Workbench standard settings.) Your Tasks view should no longer show any other errors.

Next step:

Building, Deploying, and Running Your Application