Software Development

How to programmatically add elements to a value node in Web Dynpro for Java



This article demonstrates how to programmatically add elements to a node value. Web Dynpro has this concept of context programming. A context is a hierarchical tree data structure that can consist of nodes where each node can represent a list of elements something similar in Java.

Hardware Environment


Software Environment

  • Windows 7 Professional SP1
  • Java 2 SDK 1.4.2 for Windows 32-bit
  • SAP NetWeaver Developer Studio Version 7.0.09 for Java
  • SAP NetWeaver Application Server
    • ​  – 7.00 SP26 (1000.
    • – 7.00 SP26 (1000.

Create a Web Dynpro Project


Create a Web Dynpro Project via File -> New -> Web Dynpro Project


Modify the View

1. Open the NodeElementSampleView by double-clicking it, go to the implementation tab, and put some codes
Add the following block of code within the //@begin others and //@end

 2. Add the following codes within the wdDoInit() method and between //@@begin wdDoInit() and //@@end

Modify the View’s Layout

1. Create a Node value in the View’s context

2. Add a TextView and DropDownByIndex UI elements
3. Bind the DropDownByIndex texts property to context’s Vn_UserTypeList.userTypeDescription
4. Optional – create an Application to run this Web Dynpro application
NOTE: You’ll a NetWeaver Application Server
 5. Deploy and Run New Web Dynpro Application

Sample Output


Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like