|Home • Trainings • Quiz • Tips • Tutorials • Functional • Cert Q's • Interview Q's • Jobs • Testimonials • Advertise • Contact Us|
Reuse Java Dictionary Types in Web Dynpro Development Components (Web Dynpro for Java)
By Utkarsh Kanade/Radhika Rajopadhye, Sparta Consulting
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.
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
dictionary perspective we can create a table to store persistent data thus
avoiding the use of R/3 or external database.
document is meant for all Java Web Dynpro developers and SAP portal technical
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
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
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
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’
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
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.
Steps for consuming Java Dictionary Project in Web
Steps for consuming Java Dictionary Project in Web
We will go through the following successive development
Development Component (DC) of type ‘Dictionary’
types : Simple Types ,Structures & Database
type DC visible to other DCs
Build , Create .sda
Create DC of type
Enterprise Application Project
Enterprise Application DC
Insert Records in
Java Dictionary Table
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
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM
©2006-2007 SAPTechnical.COM. All rights reserved.
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG.
Graphic Design by Round the Bend Wizards