Skip to Content



This blog is for Developing a Web DynPro Application to communicate with R/3 Back end using a BAPI Function Module. The user interface for this Web application will consist of only two views and allows the user to switch between them. In the first view, the user should be able to enter a Material Inputs in input fields and navigate to the next view to see the Return Messages from R/3 Backend.

This Blog will carry out the remote calls to the backend ABAP system using an Adaptive RFC model. To write data into the table in the ABAP system, make use of existing functions in the form of writing BAPIs that are implemented as RFC function modules. For each function module that you need in your Web Dynpro application, the corresponding Java proxy classes will be generated. All the generated proxy classes and interfaces are bundled together with the corresponding Dictionary information from the ABAP system in the RFC model and are treated as part of the Web Dynpro project.

The purpose of this Blog is to create/change the material Data. User will
Enter the required inputs in the input fields to create/change a material Data.


Systems, Installed Applications, and Authorizations:

1. The SAP Net Weaver Developer Studio is installed in the computer.

2. Basic Knowledge in creating Simple Webdynpro Applications .

3. Access to the SAP J2EE Engine (Release 6.40).

4. Access to a remote SAP back-end system. To test this example application successfully, make sure that this SAP R/3 system contains the function module BAPI_MATERIAL_SAVEDATA To access functions within an SAP system, a user must provide this system with valid credentials by means of the logon process. Since you are using the Web Dynpro Adaptive RFC Layer, the user ID defined in the Web Dynpro Content Administrator of your J2EE Engine will take care of the connection automatically.

5. The SAP System Landscape Directory (SLD) and the SLD bridge are configured and running. The SLD contains component information about all SAP software modules, the system landscape description and the name reservation service. The SLD Bridge is used to transform the system data to the correct format for the SLD server.

Initial Project Structure:

Web DynPro Project Name :   Material_SaveData

Web Dynpro Application:  Material_SaveDataApp

[The Application   Material_SaveDataApp Displays the Interface View of the web Dynpro

Component in the browser window]

Web Dynpro component:  Material_SaveDataComp

Custom Controller: Material_SaveDataCust

View   : FirstView, SecondView

           Method: executeBapi ();

           Window: Material_SaveDataWin

Developing Application :


1. Implementing access to the back end and handling transactions

a. Create a new model that is based on Adaptive RFC
b. Create the context of the custom controller and the view controller
c. Bind new model nodes in the custom controller context to the model
d. Implement transaction handling within the custom controller

2. Complete the predefined UI layer

a. Complete the view layout
b. Implement the view controller

Creating an Adaptive RFC Model:

A model is used to specify the data for Web Dynpro application.
For the purpose this application, you will import the following function modules from ABAP system:

BAPI_MATERIAL_SAVEDATA: Used to create/Change a material data.


Access to log on to the ABAP system
Make sure the function module mentioned above exists in this system.


1. In the project structure, expand the node Web Dynpro Models.

2. Select Models and choose Create Model from the context menu. The corresponding wizard appears.

3. Choose the Import Adaptive RFC Model option, followed by Next.

4. Enter the model name Material_SaveDataModel and the package name com.caritor.material_savedata.model.

When importing an Adaptive RFC model, specify the logical system names for model instances and RFC metadata:
Default logical system name for model instances: WD_MODELDATA_DEST
Default logical system name for RFC metadata: WD_RFC_METADATA_DEST Change it to WD_SAVEDATA_RFC_METADATA_DEST
The logical systems will later be configured separately using the JCO Connections screen of the J2EE Engine Web Dynpro Content Administrator (see Building, Deploying, Configuring, and Running the Application).

5. Accept the suggested values and choose next.

6. Enter the appropriate data for logging on to the SAP system and choose next.

7. Select the following function modules from the list that appears:
8. Choose Next.
This automatically triggers the generation process. The import process is logged in a detailed description, which you can see in the next dialog box.

9. Choose Finish.



Java proxies

are generated and a new model Material_SaveDataModel is inserted into project structure. In addition, a specific logical dictionary Material_SaveDataModel is also added to the project.

Creating the Contexts of the Custom and View Controllers Using the Data Modeler:

The custom controller Material_SaveDataCust is responsible for Create/Change Material to the SAP system, so it needs to be able to map the corresponding input and output to the model. To establish this correspondence between the custom controller and the model, create an appropriate controller context which will be bound to the model structure by using the Data Modeler. In this way, ensure that the model data is stored and manipulated in a central location. To display and change the data which is stored in the back end, an appropriate context in the First View which is mapped to the Material_SaveDataCust context is to be created.

Write the follwing code in DOInit method OF Material_SaveDataCust :

Bapi_Material_SaveData_Input input = new Bapi_Material_SaveData_Input ();
input.setHeadData(new Bapimathed());


Adding a Model to the Web Dynpro Component:

1. In the project structure, expand the tree up to the node Web Dynpro  Web Dynpro Components Material_SaveDataComp

2. Open the context menu of Material_SaveDataComp and choose   Open Data Modeler. The Data Modeler is opened for Material_SaveDataComp.

3. In the left toolbar, select the icon   and click into the field Used Models.

4. In the list that appears, select the model Material_SaveDataModel and confirm by Choosing ok.

By doing so, all views and controllers of Material_SaveDataComp have a dependency relationship with the model Material_SaveDataModel.

      Creating a Context for the Custom Controller:

5. In the left toolbar, select the icon to Create a data link. Click on the field Material_SaveDataCust and drag it into the field     Material_SaveDataModel.

The dialog box Edit Model Binding appears.

6. Drag Bapi_Material_Savedata_input from the right to create new context elements and bind them to the left tree.

7. In the dialog that appears, select the model nodes and Attributes.


8. Confirm with OK.

The corresponding model is created.

9.     Choose Finish.

    Creating a Context for the View Controller:

10.  In the left toolbar of Data Modeler, select the icon to create a data link. Click on the field FirstView and drag it into the field Material_SaveDataCust.

11. The dialog box Edit Context Mapping appears.

12. Proceed as described above and map new context elements in the FirstView to the following model nodes including their attributes:

13. Confirm with Finish.

.To map the Second View with model node Repeat the above steps and map the corresponding Node elements

14     Save the work by choosing (Save All Metadata) from the toolbar.

1. In the Web Dynpro Explorer, open the context menu for the application object FlightBookingApp.

2. Choose Run.


The Developer Studio automatically launches your application in the Web browser. Test the sample application by entering valid data . 

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

Leave a Reply