Show TOC Start of Content Area

Procedure documentationCreating a Web Dynpro Application using the Adaptive RFC2 Model  Locate the document in its SAP Library structure

Use

This topic provides instructions on creating a sample application that executes the BAPI_FLIGHT_GETLIST remote function module (RFM) using Web Dynpro and displays the flight list in a browser window. After creating the metadata, a model instance and executable model objects are created. Once the RFM has been executed successfully, the application retrieves the output model object and displays the output in the browser window.

Prerequisites

      You have familiarized yourself with Web Dynpro.

More information: Developing Your First Web Dynpro Application

      You have access to an R/3 system.

      BAPI_FLIGHT_GETLIST RFM exists on the R/3 system.

      You have administrator access to an SAP Java AS.

      You have launched the SAP NetWeaver Developer Studio.

Procedure

       1.      Open the Web Dynpro perspective.

       2.      Create a new Web Dynpro Development Component with the name flightlist.

1. Creating a Model

       1.      In the Web Dynpro Explorer, expand the Web Dynpro node under flightlist and create a new model.

       2.      In the New Model screen, select Adaptive RFC2 Model as the model type. Click Next.

This graphic is explained in the accompanying text

       3.      Enter the Model Name.

       4.      Enter the Model Package. All data dictionary information is put into this package during generation.

       5.      Enter the Default logical system name for model instances and the Default logical system name for RFC metadata (these are the JCo destinations). Click Next.

This graphic is explained in the accompanying text

       6.      Under Function Name enter BAPI_FLIGHT_GETLIST. To search for the RFC module, choose Search. Select the RFC module to import it to the model. Click Next.

       7.      In the Editable Model Class Names column, you can rename the model classes. If the model class name entered is invalid or if it already exists, it is reverted back to the original value. Click Next.

       8.      The descriptions of the model import status are displayed as Import Log and click Finish.

An Adaptive RFC2 model using SAP Java Connector 3.0 is created.

2. Creating an Application and Linking it to the Model

       1.      In the Web Dynpro Explorer, create a new application under flightlist.

       2.      In the Name field, enter FlightListApp. Click Next.

       3.      Select Create a new component, as the Referenced Web Dynpro Component. Click Next.

This graphic is explained in the accompanying text

       4.      Select Used Models. Click Next.

This graphic is explained in the accompanying text

       9.      Leave the settings unchanged on the Specify Window Properties screen. Click Next.

   10.      Click Add and select the model that you want to add as used models to your new component. Click Finish.

A default component, FlighListComp is visible under the Components node in Web Dynpro Explorer.

3. Defining the Component Controller

...

       1.      Under FlightListComp, right-click Component Controller, select Template Apply.

       2.      Select Service Controller as the template instance. Click Next.

This graphic is explained in the accompanying text

       3.      Select the Executable Model Class as Bapi_Flight_Getlist_Input. Click Next.

       4.      Select the context elements that you want to bind. Select Output, Flight_List_1, and Airline. Click Next.

This graphic is explained in the accompanying text

       5.      Ensure that the Generate method for model execution check box is selected and retain the generated name for execution method. Click Finish.

4. Creating the View Elements

       1.      In the Web Dynpro Explorer, expand Views and double-click FlightListCompView.

       2.      In the View Editor, select the Context tab page and then right-click on Context and select New Node.

       3.      Select Mapping to create an element with context mapping. Click Next.

       4.      Select the Required Controller as FlightListComp. Click Next.

       5.      Select Bapi_Flight_Getlist_Input node and click Next.

       6.      Select the context elements that you want to map. Select Output, Flight_List_1, and Airline. Click Finish. Save your work.

This graphic is explained in the accompanying text

       7.      Select the Layout tab page and create the following child elements to the RootElement.

       An InputField to provide input (Airline ID).

       A Button to trigger model execution.

       A Table to display results of model execution.

Save your work.

       8.      Select the Button in the View Editor. To create an event for the search button, select the Properties view. In the Properties view, under Events select onAction and then select Create. Enter the name of the event as Search and click Finish.

       9.      In the View Editor, select the InputField and bind the value to Bapi_Flight_Getlist_Input>Airline in the Properties view.

   10.      In the Outline view, select the Table and from the context menu select Create Binding and bind the value of the table to Bapi_Flight_Getlist_Input>Output>Flight_List_1.

Save your work.

   11.      Open the Java Editor for FlightListCompView and add the following code to the onActionSearch method:

wdThis.wdGetFlightListCompController().executeBapi_Flight_Getlist();

Save your work.

5. Creating JCo Destinations

You should create the JCo destinations before running the application.

Create the two new JCo destinations as WD_MODELDATA_DEST and WD_RFC_METADATA_DEST on the Java AS. The JCo destination names should be same as Default logical system name for model instances and Default logical system name for RFC metadata that you have provided while creating the model.

More information: SAP JCo Configuration

6. Building, Deploying, and Running the Application

       1.      In the Web Dynpro Explorer, from the context menu of the project node flightlist, choose Rebuild Project.

       2.      To deploy the project to the application server, choose context menu entry Deploy. A success message appears in the Tasks  view and additionally by a popup when the project has been deployed successfully. In the Tasks view there must not be any errors displayed before you go on with the next step to run the application.

       3.      In the Web Dynpro Explorer, choose Deploy new Archive and Run from the context menu of the application object FlightListApp.

Result

The Developer Studio launches the Web browser and displays the flight list in a browser window.

 

End of Content Area