Web Dynpro Questions and Answers
Web Dynpro Questions and Answers
1.Go to Se80 and select web dynpro from dropdown and enter name of webdynpro component and
description, select type as web dynpro component
2. Create a view and assign the view to window
3. Open view editor and switch to tab 'Context'. Create a context node in view controller by
opening corresponding context menu.
4. Add attributes from structure and give the name of desired table
5. Than we create User Interface element for context node under ROOTUIELEMENTCONTAINER
6. Than we create binding for our table with relevant node and enable binding for all context
attributes by activating all checkboxes
7. Than again right click on the webdynpro component we created initially and create the web
dynpro application by entering our desired name and give its description
8. Than we activate all objects and test our application
Every Web Dynpro application is structured according to the Model View Controllerprogramming model
Model:
The model forms the interface to back end system and it enables the Web Dynpro application access to
data. Its kind of act as a proxy that detaches the Web Dynpro application from the data and
functionality found in the remote system. In other words, the Web Dynpro application doesn’t need to
concern with the specific communication technology required to interact with the back end system.
View:
The view is responsible for the representation of the data in the browser. View is used to define a
client neutral visualization of the business data
Controller:
The controller lies between the view and the model. The controller formats the model data to be
displayed in the view, processes the user entries made by the user, and returns them to the model.
However , If the node is absolutely specific to only one view , it can be defined in the View Controller
Question 10: At design time how do you decide whether to declare a node in the Component
Controller or in the View Controller?
This again depends on the requirement: If the node is going to be accessed in multiple views , it should
be declared at the Component Controller level . However , If the node is absolutely specific to only one
view , it can be defined in the View Controller. As the size of Webdynpro development grows , it starts
becoming complex and the need to define attributes,nodes,methods etc. at the Component Controller
increases.
Question 5: Would you prefer creating multiple Custom Controllers OR would you go for separate Web
Dynpro components and then do Component usage.
This would actually depend on the requirement , but ideally separate Web dynpro components should
be created and reused.One can also use the assistance class for segregating business logic.
Question 6: How many component controllers can a Web Dynpro Component have ?
Component Controller is only one . You can create multiple controllers , but those are called Custom
Controllers.
Note: If you are asked about the Web Dynpro architecture , you should talk about both the MVC
framework and the controllers.
Question 7: Suppose your Web Dynpro has 10 nodes in the Component Context . Will all 10 the nodes
be available in the Interface controller?
Nodes from the Component context are available to the interface controller only when the nodes are
declared as interface nodes.To create an interface node , set the interface property to yes as shown in
the screenshot below:
Interface Node in Webdynpro ABAP
To create an interface node , set the interface property to yes as shown in the screenshot to the
right :
Once created , the interface node is indicated by a special symbol as shown in the figure below and the
property Interface Node is set to yes:
Question 9: Is it true that each controller has its own Context node ?
Yes , Each controller has it's own context , methods , and Events.
Question 10: At design time how do you decide whether to declare a node in the Component
Controller or in the View Controller?
This again depends on the requirement: If the node is going to be accessed in multiple views , it should
be declared at the Component Controller level . However , If the node is absolutely specific to only one
view , it can be defined in the View Controller. As the size of Webdynpro development grows , it starts
becoming complex and the need to define attributes,nodes,methods etc. at the Component Controller
increases.
Question 12:Are all the hook methods available to all the Controllers?
No . They are specific to controllers. See the details in the image above:
Have a look at how the control passes from component to window and then to view:
Now view is displayed . Suppose user does some action on the view:
Application is closed.
So now if you are being asked "What is called first : WDDOINIT or WDDOMODIFY?" OR
"What is called first WDDOINIT for Window controller or WDDOINIT for View Controller" ?
You should be able to answer the such questions.
Question 14: If one view is called 10 times in the lifespan of a webdynpro component , how many
times will the method WDDOINIT be called and how may times will WDDOMODIFYVIEW be called ?
WDDOINIT will be called only once.
WDDOMODIFYVIEW will be called 10 times.
WDDOMODIFYVIEW has a parameter FIRST_TIME . If this is 'X' , then the view is getting called
first_time.
Question 15: What are PRE POST and OVERWRITE exit methods in web dynpro?
Whenever a web dynpro component is enhanced , these 3 methods become available for all methods in
Webdynpro. Lets take an example of these methods for WDDOINIT.
We can write the business logic in the methods of the View, Window or even
the Component controller. But it is not a good practice to load all the
business logic in the views or windows. So SAP has provided an option of
assistance class where you can write all your business logic. By this way, you
are still in the framework of your webdynpro and also avoid loading too much
logic in the components of webdynpro itself. Assistance class methods are
much better from a performance point of view than calls of Web Dynpro
controller methods.
A web dynpro component will have only one assistance class and it is
defined at the component level as per the screenshot below. The assistance
class is automatically instantiated when a component is called. You can
access the instance of this class with the attribute wd_assist, which is
created when you create the assistance class in web dynpro.
Imp*
Question 17: What is Singleton Property of a Context Node?
Understanding Singleton property of a context node and how it works in
conjunction with the lead selection event can be a bit complicated. If you do
not already know what a Singleton set is , I recommend you going through an
example of Cars(Parent node with cardinality 0..n ) and Customers ( Nested
child node with cardinality 0...n ) on Singleton Node by clicking on the link.
This is not that tough , just spend some time with it and you should be okay.
Question 21: Is there any relation between Cardinality and Lead selection?
Yes , If the cardinality is set to 0:1 or 1:1 , the user cannot select multiple records on the
view.
So if you want the user to be able to select multiple records on the screen , the cardinality of
that particular node must be set to 0:n or 1:n.
Question 22: Some important Web Dynpro attributes that you should know:
Some attribute in webdynpro that are used very frequently and some of
those that you must know are :
Wd_this
Wd_context
Each controller has the above two mentioned attributes.
To elaborate, if you are using the above two attributes say in a method of a
View Controller, then WD_CONTEXT is the reference to the Context node of
the View and WD_THIS is the reference to the View Controller itself.
Wd_assist: This attribute is created when the assistance class is saved and
activated for a web dynpro component. All the methods of the assistance
class can be accesses by using this attribute.
Question 25: How do you introduce line break for a UI element in any
layout?
Say if you are using matrix layout, you will say Matrix Head data for the UI
element for which you need a line break.
Question 26:Can you call/launch one web dynpro application from another
webdynpro application?
Yes, you can launch one webdynpro application from another webdynpro
application.
First, you should get the URL of the web dynpro component that you want to
launch and second, call that URL in an external window.
To get the URL of any web Dynpro component, you use the FM
CALL METHOD cl_wd_utilities=>construct_wd_url
EXPORTING
application_name = 'ZDEMO’
IMPORTING
out_absolute_url = str.
Once you get the URL in str, you can call this web dynpro using 'str' and
fm: create_external_window.
Question 27: Can you create a Tcode for Webdynpro Application?
Yes, you can create a Tcode for webdynpro application. Go to SE93 , create
Tcode, choose the last option and maintain default values as shown in the
screenshot:
Question 29: How do you read parameters passed in the Web Dynpro URL?
First lets understand how a typical webdynpro application looks like:
When you create a web dynpro application , you can see the link URL
generated by web dynpro.
It will be something
like:http://domainname.com:8000/sap/bc/webdynpro/sap/zdemo_webdynpro?
sap-language=EN&sap-client=100.
Whatever comes after the ‘?’ and is followed by ‘&’ is an URL parameter. You
can see sap-language and sap-client as default parameters whenever you
launch your web dynpro in browser. The cool thing is you can add some
custom variables
too. http://domainname.com:8000/sap/bc/webdynpro/sap/zdemo_webdynpro
?sap-language=EN&sap-
client=100&var1=4500000001&var2=00010.
So var1 and var2 are custom webdynpro URL parameters and you can read
them in the HANDLEDEFAULT method of your main window:
So we have by now put a bunch of questions here . Let me know how do you
find these questions.
We haven't yet covered Web Dynpro component usage , ALV, Select Options ,
OVS , the coding part in web dynpro, Web dynpro enhancements etc.
The Web Dynpro framework provides you with a technique called ‘Component Usage’, with
the help of which you can reuse the events, methods, and context of one WD component
into another WD component.
Standard examples of Component Usage: Select Options , ALV , OVS.
You declare component usage both at the Component and at the view levels:
@Component Level:
@View Level:
Question 2: Briefly explain how will you use implement Select Options in Web
Dynpro?
1) Declare Component Usage for Standard WD componentWDR_SELECT_OPTIONS both at
component and view level.
If you want to get into the details , have a look at the webinar from Chris
Whealy: Understanding the Web Dynpro Phase model.
Important
Question 4: What is OVS? Can you explain the different phases used in OVS?
First we should understand the difference between Value help and OVS i.e. object Value
Selector.
We use generic Value Help only for the field to which it is bound.
OVS is used when we want to populate multiple fields based on one field on the screen.
So as per the screenshot , If I select Userid from OVS help, First name and Last name will be
populated automatically. The standard component WDR_OVS is used for implementing
OVS.
OVS works on the PHASE MODEL and different tasks are performed during different
phases.
The current phase is indicated by the parameter PHASE_INDICATOR.
Phase 1:
In this phase you have the possibility to define the texts, if you do not want to use the
defaults: So You can play around with the highlighted texts in the screenshot below in this
phase.
Here we call the method ovs_callback_object->Set_Configuration
Phase 2:
If you do not want the filter fields, you can do that in this phase and the table will be
displayed directly. Refer screenshot below. The table is displayed directly. I have blurred
some results.Here you can call the methodovs_callback_object->Set_Input_Structure
Phase 3:
In this Phase, You write the select queries that should run as per user input when the user
hits ‘Start Search’ button and finally set the output table.You can call the
method ovs_callback_object->Set_Output_Table for that purpose.
Phase 4:
In this phase , you pass the selected record to the Web dynpro Fields.
i.e. set the attributes using ovs_callback_object->context_element->Set_Attribute
Question 5: Briefly explain how will you implement ALV in Web Dynpro?
To implement ALV in Web Dynpro, you need to use the Standard WD
component SALV_WD_TABLE.
We need to use:
a) the view ‘TABLE’ of component SALV_WD_TABLE
b) the node ‘DATA’ of component SALV_WD_TABLE.
Here is the brief process:
1) Declare component Usage for SALV_WD_TABLE at the WD component level and the view
level.
@ Component Level:
@ View Level:
2) Put a VIEWCONTAINER UI element on the MAIN view and ember the view‘TABLE’ of
SALV_WD_TABLE into it.
3) Let’s say the ALV data is to be populated in NODE_FLIGHT.
Write the logic to select the ALV Data and bind it to NODE_FLIGHT:
node_flight_alv->BIND_TABLE( lt_node_flight_alv ).
There is a special outbound plug called ‘Exit Plug’ that can be used for this purpose.
wd_this->fire_to_exit_plg( url = url close_window = close_window ).
Question: What is the difference between Drop down by key and drop down by
index ?
Question: How do you display error / success / warning messages in Web Dynpro ?
Question: Can you have Totals and Subtotals in Web dynpro ALV ? How ?
Hint: First get the reference of the ALV. Then get the columns.
By looping at lt_columns , get to the required column.
Once you achieve this, check methods create_aggr_rule and create_sort_rule of the
class
cl_salv_wd_field.
Question: Can you have TOP OF PAGE and END OF PAGE ? How ?
Hint: Check TOP_OF_LIST and END_OF_LIST events.
Question: Can you add custom buttons in Web Dynpro ALV cells ? How?
Question: Can you add Image / Icons in Web Dynpro ALV cells ? How?
How do you define and implement action handlers for them?
How?
What is cardinality in WebDynpro ABAP?
How to share data between view ? Is there any way other than component
controller?
Can we use data element & data type for context attributes?
Architecture is applicable in WDABAP apps?
Can you use multiple layouts in one view in web dynpro ABAP?
Can you call one web dynpro application from another webdynpro
application? explain ?
Tell me any five UI elements which you worked on in Web Dynpro ABAP ?
What are the methods used for integrating Select-Options in Web Dynpro
ABAP ?
What is service call in Web Dynpro ABAP ? What is the purpose of it?
What are the advantages of using Adobe forms in Web Dynpro ABAP apps?