Webdynpro Interview Ques
Transcript of Webdynpro Interview Ques
SAP Webdynpro ABAP Interview questions
1. What is the difference between narrowing cast and widening cast?
If we copy an instance of sub class to super class its called narrowing cast and the vise versa of it is widening cast.
2. Is model used in Webdynpro ABAP?
The webdynpro ABAP Graphical tool set doesn’t give any option to create model. We can define a class in transaction SE24
and the instance of that class can be used as model within the Wedbynpro code.
3. What are the different ways of getting data from a table and pass it to Webdynpro context node?
a. select the data to an internal table and pass it to the node using bind table method
b. use a model class instance to get data
c. use the service call option provided by webdynpro framework
4. What is the Service call option in Webdynpro ABAP?
Webdynpro ABAP Graphical toolset gives a wizard which automatically generates the code for calling a BAPI or Web
service. This wizard will create a custom controller which has context nodes or attributes similar to the parameters of BAPI
and a method which calls the bapi and pass the value to the context. We only need to use this custom controller within
another controller, map the context and call the method.
5. What is an Application?
An application forms as the link between a component and URL.
6. What is a faceless component?
Faceless components are webdynpro components without window or view
7. In case of a component used within a component, how does parent component communicate to child component?
Parent component communicate with the child component through Interface controller and Interface view of the child
component.
8. Interface View of a component has 1:1 relationship with ..?
The window of the component
9. What are actions in a view controller?
The methods that can be linked to the UI elements of a view are called actions.
10. What is role of plugs in views?
Plugs in views help the navigation between views. Navigation happens through the linkcreated between outbound plug of a
view to the inbound plug of next view.
SAP Webdynpro JAVA Interview questions
1. Webdynpro framework is based on which design pattern?
MVC design pattern.
2. What is a component?
A component is the unit of project which contains the actual functionality and it can be reused
3. What is a model?
A model is any layer of code that encapsulates some business functionality external to the
Web Dyn-pro environment.
4. What is the difference between component controller and view controller?
Component controller is the main controller of the entire component and it’s a global controller. View controller is the
controller associated with a view.
5. Which all are the global controllers
Component controller and custom controller
6. What does the component interface contains?
The Web Dynpro component interface consists of two parts: a visual one and a programmatic one, and defines the set of
publicly accessible entry points to the component. Visual part is interface view which corresponds to a window in component
and the programmatic part is Interface controller.
7. What is a context?
All controllers, whether view controllers, custom controllers or component controllers, have a dynamic data storage area
known as a context. Context contains nodes and attributes where data is stored
8. What is cardinality of a node?
Cardinality represents the number of elements a node has at the start of the applicationand maximum number of elements it
could have during its life time
9. What is a singleton node?
Singleton nodes are represented by a single node instance, whose content – that is, its node collection - changes each time
the lead selection of the parent node changes.
10. What is the purpose of supply function in a node?
Supply Function is used to populate the values in a node on demand. The supply function is called by the runtime when the
data of the context node is used. This is the case when a UI element is to be displayed for the first time with the data of the
corresponding context
Difference between Webdynpro ABAP and Webdynpro JAVA
Webdynpro for ABAP and Webdynpro JAVA use the same declarative metamodel concept based on MVC pattern
to create web applications. Everything about Webdynpro ABAP is same as Webdynpro JAVA, except that it uses ABAP as
programming language instead of JAVA. It also has a graphical interface tool that is integrated with the ABAP Workbench
(Transaction Se80). Both Webdynpro ABAP and Webdynpro JAVA applications are run in the Enterprise Portal.
What is the difference between Webdynpro JAVA and Webdynpro ABAP?
The main difference between Webdynpro JAVA and Webdynpro ABAP is that Modeldoesn’t have much significance in
Webdynpro ABAP. In fact there is no option formodel available in the Graphical tool set to develop Webdynpro ABAP
application. But we still have the option of defining an ABAP class which helps to read data and save data back to table. The
instance of this class should be used as model within the component and this is the proper design. Webdynpro ABAP gives
new option called Service Call. In Service Call a wizard creates a custom controller based on the BAPI or Web Service that
we give. Context of this controller will be generated based on the import – export parameters of BAPI or Web Service. The
wizard will also automaticallycreate methods in the controller to execute the BAPI or Web service and pass the data to
Context. This Custom controller can be used within other controllers to read and update data.
Other main difference in Webdynpro ABAP is that code is stored centrally in the ABAP server, so it relieves the load from
developer’s client machine where code is stored in the case of Webdynpro JAVA. Webdynpro ABAP has much more
powerful Version control system than Webdynpro JAVA as the code is stored centrally in the server. In webdynpro JAVA as
each developer is checking out and checking in the code, there are chances of conflicts. Webdynpro ABAP uses the same
Transport Management system as R/3, so there is no need to maintain parallel Transport Management system which is the
case in Webdynpro JAVA. Webdynpro JAVA runs on sun’s proven web server (J2EE engine) which can support large
number of web users at a time. But the ABAP server is yet to prove its credential as a reliable Web Server. So if the number
of users are large, its better to go for Webdynpro JAVA and if the number is medium or manageable, you can go for
Webdynpro for ABAP. Performance and scalability should be the major criteria while choosing between Webdynpro JAVA
and Webdynpro ABAP.
How to create a three level tree node in Webdynpro ABAP
The purpose of this example is to create a three level tree node in Webdynpro ABAP. First level will be all distinct Carrier
ids. Under carrier id there will be Connection id as second level. And under Connection id there will be Plane types as third
level.
1. Create a Webdynpro component with one view
2. Create a Node FLIGHT with cardinality 1:1. Create sub node CARRID_NODE within FLIGHT, sub node CONNID_NODE
within CARRID_NODE and sub node PLANETYPE_NODE within CONNID_NODE. All the sub nodes should be non
singleton and should have cardinality 0:n. Create attribute CARRID type SFLIGHT-CARRID, CONNID type SFLIGHT-
CONNID and PLANETYPE type SFLIGHT-PLANETYPE within CARRID_NODE, CONNID_NODE and PLANETYPE_NODE
respectively.
3. Create a Tree UI element in the layout of View. Create two Tree Node Types CARRID and CONNID. And create a Tree
Node Item PLANETYPE.
4. Bind the property DATA SOURCE of Tree UI element with FLIGHT Node.
5. Bind CARRID_NODE node to property DATA SOURCE of CARRID Tree Node Type. And bind CARRID attribute within
CARRID_NODE to property TEXT.
6. Similarly bind CONNID_NODE node to property DATA SOURCE of CONNID Tree Node Type. And bind CONNID
attribute within CONNID_NODE to property TEXT. And PLANETYPE_NODE node to property DATA SOURCE of
PLANETYPE Tree Node Item. And bind PLANETYPE attribute within PLANETYPE _NODE to property TEXT.
7. Create supply functions FILL_CARRID, FILL_CONNID and FILL_PLANETYPE for the nodes CARRID_NODE,
CONNID_NODE and PLANETYPE_NODE respectively.
8. In the FILL_CARRID method write the following code,
types : begin of ty_carrid,
carrid type sflight-carrid,
end of ty_carrid.
data : lt_carrid type table of ty_carrid.
select distinct carrid
into table lt_carrid
from sflight.
node->bind_table( lt_carrid ).
Select all the distinct CARRID values from SFLIGHT and pass it to the NODE.
9. In the FILL_CONNID method write the following code
types : begin of ty_connid,
connid type sflight-connid,
end of ty_connid.
data : lt_connid type table of ty_connid,
lv_carrid type sflight-carrid.
parent_element->get_attribute(
exporting
NAME = 'CARRID'
importing
VALUE = lv_carrid ).
select distinct connid
into table lt_connid
from sflight
where carrid = lv_carrid.
node->bind_table( lt_connid ).
Get the selected CARRID by the user, for that get all distinct CONNID
from SFLIGHT and pass it to the node.
10. In the FILL_PLANETYPE method write the following code
Types : types : begin of ty_planetype,
planetype type sflight-planetype,
end of ty_planetype.
data : lt_planetype type table of ty_planetype,
lv_connid type sflight-connid.
parent_element->get_attribute(
exporting
NAME = 'CONNID'
importing
VALUE = lv_connid ).
select distinct planetype
into table lt_planetype
from sflight
where connid = lv_connid.
node->bind_table( lt_planetype ).
Get the selected CONNID by the user, for that get all distinct PLANETYPE
from SFLIGHT and pass it to the node.
11. Add the view to the window, create an Application and activate the
entire component. Now Test the application.
12. The output you get will be like this. Under the root node Flights, first level will be all distinct Carrier ids. Under carrier id
you will have distinct Connection id for that Carrier id. And under Connection id you will have distinct Plane types for that
Connection id.
ABAP with SAP Netweaver Certification preparation questions
Webdynpro ABAP
Narrowing cast in ABAP is....
a) copying sub class object to super class object
b) copying super class object to sub class object
c) copying from one instance of a class to another
Ans: a
2) Webdynpro ABAP development tool is integrated in the ABAP transaction
a) WD_DEVELOP
b) SE38
c) SE80
d) SE24
Ans: SE80
3) Service call will generate a new___________ for accessing data from a BAPI
a) Component
b) View
c) Custom Controller
Ans: c
4) Which all are global controllers in Webdynpro
a) Custom controller
b) Component controller
c) View Controller
d) All of the above
Ans: a and b
5) Is it mandatory for a component to have a window
a) Yes
b) No
Ans: b
6) Which is the cardinality of a node which is bind to a table?
a) 0:0
b) 0:1
c) 0:n
d) 1:n
Ans: c and d
7) What acts as the link between Component and a URL
a) View
b) Window
c) Component controller
d) Application
Ans: d
8) Which of the below acts as a collection of views
a) Window
b) Model
c) View itself
Ans: a
9) Context is a …
a) place to store hook methods
b) place to store all methods
c) dynamic data storage area
d) link between view and window
Ans: c
10) Supply function contains….
a) method to populate node with values on demand
b) method to clear node
c) method to pass values from node to UI element
Ans: a
Model View Controller - MVC
MVC - Model-View-Controller - is a design pattern for the architecture of web applications. It is a widely adopted pattern,
across many languages and implementation frameworks, whose purpose is to achieve a clean separation between three
components of most any web application:
(Model View Controller) an Architecture for building applications that separate the data (model) from the user interface
(view) and the processing (controller). Providing a programming interface between the data and the processing has been a
primary concept in information technology for decades. MVC is widely used in Web-based application frameworks. The clear
separation between the Model, View and Controller helps the maintenance of existing applications, as we can change any
component without affecting other two as the three are independent. This architecture helps in reusing existing components
for make new applications.
In practice, MVC views and controllers are often combined into a single object because they are closely related. For
example, the controller code validates a request for data and causes it to be returned in a view. View-controller objects are
tied to only one model; however, a model can have many view-controller objects associated with it.
Model: business logic & processing
View: user interface (UI)
Controller: navigation & input
posted by sap next at 9:06 pm 0 comments
labels: webdynpro java
Webdynpro for JAVA
WebDynpro Frame work helps to create applications using declarative programming techniques based on the Model View
Controller (MVC) design paradigm. That is, you specify what user interface elements you wish to have on the client, and
where those elements will get their data from. All the code to create the user interface is then generated automatically within
a standard runtime framework. This relieves you from the repetitive coding tasks involved in writing HTML and then making
it interactive with JavaScript.
The WebDynpro technology provides a development and runtime environment for Web applications and enhances classical
Web development to build easily adaptable user interfaces. SAP's Web Dyn-pro technology closes significant gaps between
typical Web development tools and the needs of cost-effective, responsive, easy-to-use, maintainable, and professional
browser-based user interfaces for business solutions. WebDynpro uses design principles similar to SAP's Dynpro
technology, but it is a completely new technology geared exclusively towards Web applications. Its main features include the
following:
• Usability
• Abstract modelling
• Personalization and customization
• Separation of presentation layers and business logic
• Generic services
• Portability
WebDynpro applications run in the SAP Enterprise Portal.
The main aims are to avoid coding as far as possible and achieve independence from the back-end platform and front-end
technology. Web Dynpro delivers a declarative metamodel to develop user interfaces while writing less programming code.
Web Dynpro uses this abstract definition to create a ready-to-run Web application for runtime platforms.
Additionally, WebDynpro has a graphical toolset and an embedded IDE (Integrated Development Environment) that help
developers to create the Web Dynpro metadata. Since Web Dynpro is a declarative programming toolset, it handles all the
mundane aspects of pro-gramming the UI for you. So you can shift your attention away from the specific details of coding
the user interface and onto the flow of data through the business process itself.
For instance, if you want a list of suppliers for a particular product displayed in a dropdown list, you just declare a dropdown
list and specify where that UI element will get its data from in a data storage area known as the context. To populate the
context you have to write some coding but Web Dynpro will generate the coding for the UI and data transport for you.
The only code you have to write is the implementation of those actions that cannot be described in a declarative manner.
Such actions would include silently logging on to an SAP system, executing a BAPI call or implementing an action listener
event.
What is the difference between Webdynpro and BSP?
BSP (Business Server Pages) is for creating simple web applications using ABAP, HTML and JavaScript. BSP
applications are more flexible as we can do lot of client side activities using JavaScript. Where as Webdynpro is used to
create Web applications with strict screen guidelines. It is used to create Web transactions with almost similar UI guidelines
as SAP GUI transactions. Webdynpro cannot be used to make flexible applications as the webdynpro Framework follows
the strict UI guidelines.
From a developer’s point of view, one of the most fun-damental differences is this: In other web development tools, such as
BSP or Java Server Pages for in-stance, the unit of development is the web page, and your application consists of a set of
connected pages that together, supply the required business functionality.
Not so with Web Dynpro! In the Web Dynpro world, the unit of development is the “component”. A component is a set of
related JAVA Classes that together, form a reusable unit of business function-ality.
A component however, can have multiple views. A view is also a set of ABAP Classes that function as a subordinate unit
within a component. A view cannot exist outside the scope of its parent compo-nent, but a component could have many
views.
The different parts of a Webdynpro Component are,
WebDynpro Component
A component is the unit of a project that contains actual functionality, and if written carefully, can ei-ther be reused by other
projects or within other components of the same project.
Web Dynpro has two types of controller:
• View controllers
• Custom controllers: component controller is a type of custom controller.
Component Controller
The component controller is the main controller for the entire component and never has a visual inter-face. This controller is
the main repository for the entire component’s data and is the heart of the component's processing logic. Different subsets of
the data held within the component controller can be supplied to view controllers for visualization or custom controllers for
some specific processing task.
Custom Controller
A custom controller is a special type of controller of a Web Dynpro application, which the Web Dynpro application developer
can create explicitly if required. Like all other controller types, the custom controller contains a context class, which is
automatically generated when the custom controller is defined. Furthermore, the custom controller contains imported
packages and methods that are then relevant to all classes in a Web Dynpro application. The custom controller is also the
part of an application that implements the event handlers and validators that react to actions.
Model
A model is any layer of code that encapsulates some business functionality external to the Web Dyn-pro environment. A
model provides access to functionality such as BAPI calls or Web services, and can be implemented as a set of proxy
objects or Enterprise Java Beans and so on. You create mod-els at project level and each component in the project uses
them as needed.
Component Interface
The Web Dynpro component interface consists of two parts: a visual one and a programmatic one, and defines the set of
publicly accessible entry points to the component.
You can implement coding to validate user parameters received in the component interface controller.
Underneath the component interface is a controller. The methods and attributes of this controller provide the only publicly
accessible entry point into the component. The methods and attributes of all the other controllers making up this component
are completely encapsulated, and so invisible to the outside world.
If the functionality of your component is embedded in another Web Dynpro component, the parent component only has
access to those methods declared in the interface controller.
The interface controller will, by default, have a view automatically defined. This is because compo-nents usually have a
graphical user interface. The implementation of the interface view does not normally require any work beyond simply
declaring the existence of the component. Unless you say otherwise, whatever view you first embed into the component’s
window will become the default com-ponent interface view.
All controllers can have defined entry and exit points known as plugs. Plugs are the standard entry and exit points to and
from all controllers. This means that when the Web Dynpro runtime environ- ment invokes a controller for the very first time,
a special inbound plug must be present that acts as the standard entry point. This plug must be of type startup, and is
normally called Default.
You may change the name of plug Default if you wish, but if you change its type to something other than startup, then when
the Web Dynpro runtime fires the event to start the application, an unhan-dled event exception occurs.
Since you have a standalone component that does not embed any other components, and is not em-bedded in another
component, you can ignore the interface controller.
Default Window
The default window is usually needed since almost all components have some sort of visual interface. However, if you are
creating a faceless component, the default window will still be present, but just unimplemented.
Window
Whenever you create a component, a window is automatically created for that component. Normally, this window will have
at least one view embedded within it, and becomes the default interface with which the user interacts. However, you can
create what is known as a faceless component, that is, a component that has no user interaction. Such faceless
components will only work in combination with normal components that contain views, since the whole point of the Web
Dynpro toolset is to provide a browser-based user interface to business functionality.
View
A view is the visual component inside a window with which a user interacts. To be visible a compo-nent, it must have at least
one view. A window can have multiple views arranged in different layouts, for example grid-, flow- or matrix layout, or even
have views nested within views.
Application
An application defines an entry point into a Web Dynpro component. Components, in themselves, cannot be accessed
directly by the client software. Instead, they must be accessed via an applica-tion. The application associates a URL with a
standard entry point in the component interface known as a plug. There is a one-to-one relationship between an application
and a component entry point. Therefore, if you wish to give your component multiple entry points, you must define multiple
applica-tions.
What is a Context?
All controllers, whether view controllers, custom controllers or component controllers, have a dynamic data storage area
known as a context. The context consists of a basic static structure, to which you can add both data and metadata at
runtime. The actual context structure obtained at runtime is de-pendent upon the declarations you make at design time.
The context holds both metadata and actual data. However, the context is not a passive data storage area; rather it is a
highly dynamic, hierarchical data storage class whose metadata is defined at de-sign time, but whose actual contents (and
possibly even extra metadata) are not known until runtime.3
You can think of the context as the central, dynamic class that supplies a controller with both the ac-tual data upon which it
acts, and the metadata to describe that data.
Context Structure
The context is a hierarchy consisting of two basic types of entity – nodes and attributes. The only difference between the two
is that a node may have children, and an attribute may not.
Nodes and attributes that have the context root node as their immediate parent are referred to as independent. Nodes and
attributes that have some other node as their parent are referred to as de-pendent.
The difference between independent and dependent nodes does not feature in this example. But in complex situations
where a child component must map one of its context nodes to a node living in a parent component, the difference becomes
significant.
Cardinality
Cardinality represents the number of elements a node has at the start of the application and maximum number of elements it
could have. It has two parts, Mandatory and Maximum. Mandatory represents the number of elements a node has at the
start of the application and Maximum represents the maximum number of elements it could have during its life time.
Cardinality
Meaning
1:1
The node contains only one element instance; this instance is instantiated automatically.
0:1
The node contains only one element instance; this instance must not be instantiated.
1:n
The node can contain multiple element instances of which at least one must always be instantiated (and is instantiated
automatically).
0:n
The node can contain multiple element instances of which none have to be instantiated.
What are the Standard Hook Methods For?
When a controller class is created, there are certain standard hook methods that are always present irrespective of whether
or not you implement them.
The methods WDDOINIT and WDDOEXIT are always present in all controllers and serve the fol-lowing purposes.
• The method WDDOINIT is called immediately after the controller has been instantiated. Preparatory work should be
performed in this method.
• The method WDDOEXIT is called immediately before the controller is garbage collected. You should write code to perform
clean up tasks in this method.
What are Singleton and Non-Singleton Nodes?
In general, dependent nodes are represented by a single node instance, whose content – that is, its node collection -
changes each time the lead selection of the parent node changes. Such context nodes are known as single nodes. The
existence of a single node instance considerably reduces the resources that are required at runtime. This improves the
performance of the application significantly. However, the use of singleton nodes also results in programming restrictions.
This means that the user can only access data of the child nodes that belong to the code element (lead selection) currently
selected in the parent node. Consequently, you cannot read - for example - the address fields of a business partner X if
business partner Y is currently selected. Each modification of the parent node lead selection causes a data modification of
the singleton child node.
Therefore, Web Dynpro allows you to define additional non-singleton nodes. Each non-singleton node has one node
instance for each node element of the parent collection at runtime. The advantage is that each instance can be accessed
directly. When using non-singleton nodes, the nodes are only created when the node values are retrieved. This can save
resources that otherwise would slow down the performance of the application.
Supply Function is used to populate the values in a node on demand. The supply function is called by the runtime when
the data of the context node is used. This is the case when a UI element is to be displayed for the first time with the data of
the corresponding context.
posted by sap next at 9:04 pm 0 comments
labels: webdynpro java
wednesday, november 5, 2008
SAP Webdynpro JAVA Interview questions
1. Webdynpro framework is based on which design pattern?
MVC design pattern.
2. What is a component?
A component is the unit of project which contains the actual functionality and it can be reused
3. What is a model?
A model is any layer of code that encapsulates some business functionality external to the
Web Dyn-pro environment.
4. What is the difference between component controller and view controller?
Component controller is the main controller of the entire component and it’s a global controller. View controller is the
controller associated with a view.
5. Which all are the global controllers
Component controller and custom controller
6. What does the component interface contains?
The Web Dynpro component interface consists of two parts: a visual one and a programmatic one, and defines the set of
publicly accessible entry points to the component. Visual part is interface view which corresponds to a window in component
and the programmatic part is Interface controller.
7. What is a context?
All controllers, whether view controllers, custom controllers or component controllers, have a dynamic data storage area
known as a context. Context contains nodes and attributes where data is stored
8. What is cardinality of a node?
Cardinality represents the number of elements a node has at the start of the application and maximum number of elements it
could have during its life time
9. What is a singleton node?
Singleton nodes are represented by a single node instance, whose content – that is, its node collection - changes each time
the lead selection of the parent node changes.
10. What is the purpose of supply function in a node?
Supply Function is used to populate the values in a node on demand. The supply function is called by the runtime when the
data of the context node is used. This is the case when a UI element is to be displayed for the first time with the data of the
corresponding context
posted by sap next at 5:16 pm 0 comments
labels: interview, webdynpro java
JAVA with SAP Netweaver Certification preparation questions
Webdynpro JAVA
1) Which all are global controllers in Webdynpro
a) Custom controller
b) Component controller
c) View Controller
d) All of the above
Ans: a and b
2) Is it mandatory for a component to have a window
a) Yes
b) No
Ans: b
3) The business functionality external to the webdynpro enviornment is encapsulated within
a) Component controller
b) Custom controller
c) Model
Ans: c
4) Which is the cardinality of a node which is bind to a table
a) 0:0
b) 0:1
c) 0:n
d) 1:n
Ans: c and d
5) What acts as the link between Component and a URL
a) View
b) Window
c) Component controller
d) Application
Ans: d
6) Which of the below acts as a collection of views
a) Window
b) Model
c) View itself
Ans: a
7) Which is the smallest unit of a product that can be delivered to the customer?
a) Software Component
b) Development Component
c) Project
Ans: a
8) Which is not a hook method in view controller
a) wddoinit0
b) wddomodifyview()
c) wddoexit()
d) wddopostprocessing()
Ans: d
9) Context is a …
a) place to store hook methods
b) place to store all methods
c) dynamic data storage area
d) link between view and window
Ans: c
10) Supply function contains…
a) method to populate node with values on demand
b) method to clear node
c) method to pass values from node to UI element
Ans: a