Reuse Java Dictionary Types in Web Dynpro Development Components (Web Dynpro for Java)

By Utkarsh Kanade/Radhika Rajopadhye, Sparta Consulting


Dictionary perspective is one of the many perspectives available in NWDS. We often come across scenarios where we feel custom data types can be re-used. E.g. a String data type of length 20 can be re-used by a number of applications. This can be achieved using dictionary perspective.  

Also, there are scenarios where we want a persistent data store like a table and are left with no option other than using R/3 or external database like oracle or SQL.

In dictionary perspective we can create a table to store persistent data thus avoiding the use of R/3 or external database.  


This document is meant for all Java Web Dynpro developers and SAP portal technical architects.  

Java Dictionary

·         The SAP Web Application Server provides varied options for all aspects of application development. Different techniques, such as JDBC, are provided also for the database connection for applications.

·         Central storage for neutral platform definition of data types and database objects is very helpful if you are programming extensive SAP applications. SAP provides this storage area in the form of the Java Dictionary.

The Java Dictionary enables the following:

·         Data type descriptions for Web applications can be described centrally, redundancy-free, and independently of the program code.

·         In standard J2EE programming, there are three layers: presentation layer, business layer, and database layer. Cross-layer, reusable storage of data descriptions is possible.

·         You can define platform-independent data types.

·         The provided type system is based on XML.

·         In the Java Dictionary, you can store metadata and services for database objects and user interfaces (Web Dynpro).

·         The Java Dictionary provides additional data compared to the database catalog of the respective database system being used. Data type definitions for fields, for example, can be given an input help or a field label.

Elementary Data Types

Elementary data types are used in the new SAP programming model for user interfaces, Web Dynpro. Information from the Java Dictionary can be used in many ways:

·         If a type from the Dictionary is assigned to an input field, the Web Dynpro runtime automatically checks whether the values entered match the type.

·         If there is a fixed set of values for a type, this value set is proposed to the user in a dropdown list.

·         The label text for an input field or the heading of a table column can be derived, on the basis of the respective language, from the Dictionary information on the field (or column). This is done through the generation of suitable properties files.  

Tables & Indexes

With Open SQL for Java, SAP offers a persistence framework that ensures automatic portability in all database systems. All tables and indexes that are created in the database must be defined first in the Java Dictionary. 

The tables defined in the Java Dictionary can be accessed using Open SQL/JDBC or Open SQL/SQLJ. For SQLJ, SAP provides additional utilities (SQLJ Editor, Translator, and so on). As of now, we are going to concentrate on using Open SQL/JDBC.

Type checks that are executed in Open SQL for Java are based on the definitions in the Java Dictionary

Why use Java Dictionary  

Java Dictionary Framework applied in conjunction with NWDS can help you avoid redundant data type definitions. You can create the application specific data types, tables in dictionary and can reuse them extensively in other applications.

Java Dictionary follows ‘Write Once, Reuse Everywhere’ paradigm.  

This document demonstrates how to apply data types defined in a Development Component (DC) of type Dictionary as types of database table columns and, on the other hand, as the data types of UI elements within Web Dynpro for Java views. Consider the following scenario:  

Within Dictionary DCs, data domain experts  

  • Develop application specific data types.
  • Apply them as types of database table columns.
  • Check the types into the Design Time Repository server (DTR) of NWDI. 

Subsequently, Web Dynpro skilled developers can check them out and reuse consistently within Web Dynpro DCs.  

This way Dictionary DCs can act as a type repository of the database layer and presentation layer of your, possibly complex, Java application, as you can view in the picture below. If you change a Dictionary type, all the objects that use it are established upon generation. The objects that are found are automatically adjusted to include the change.  



  • SAP Netweaver Developer Studio 04/04s

  • SAP J2EE Engine configured in Windows->Preferences

 Steps for consuming Java Dictionary Project in Web Dynpro DC

We will go through the following successive development steps:  

·         Create Development Component (DC) of type ‘Dictionary’

·         Define Dictionary types : Simple Types ,Structures &  Database Tables

·         Make Dictionary type DC visible to other DCs

·         Build , Create .sda and deploy Dictionary DC on J2EE server

·         Create Web Dynpro DC and Define UI fields

·         Create DC of type Enterprise Application Project

·         Define Database Alias

·         Define Project References

·         Build, deploy Enterprise Application DC

·         Insert Records in Java Dictionary Table

·         Select Records from Java Dictionary Table  


Create Development Component (DC) of type ‘Dictionary’  

Open Java Dictionary Perspective

Open NWDS 04. Go to Windows->Open Perspective->Other

Select Dictionary. Click on OK.  


Click on File menu->New->Other  

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image