Saturday, October 27, 2012

SAP Web Dynpro ABAP Interview Questions Part1



Preparing for SAP web dynpro ABAP interview ? You have come to the right place :). This blog
will be your friend in your preparation . I believe in doing things one step a time . That is why I 
am planning to divide this blog into 3-4 parts for your maximum benefit . Do these one at a time 
and you will be all set for your SAP webdynpro ABAP interview in 3-4 days. All the best!

Let's get started:

Imp*:What is Model-View-Controller MVC architecture in Web Dynpro ABAP?
This is one of the most common Web Dynpro ABAP interview questions. I am sure you will be
asked about this. This is your chance to show how much you know about Web Dynpro .
Prepare this answer on your own 

Controllers in Web Dynpro:

Question 1: What are the types of Controllers in Web Dynpro ABAP?
The types of controllers are listed in the screenshot below:
Types of Controllers in Webdynpro ABAP
Types of Controllers in webdynpro ABAP

Question 2: What is Component Controller?
Component Controller is the King of all Controllers. It is the backbone of your Web Dypro Component .
It is like a Global or Top Include for you program . It controls the entire activity of your
Web Dynpro Component.

Question 3: What is an Interface Controller?
Whenever we want views , nodes or methods of a particular web dynpro component to be available
to other the outside world ( i.e. other webdynpro components) , we make use of Interface controller .
Interface Controller is created by default when a webdynpro component is created.
Interface Controller would generally come into picture when you are doing component usage of
some sort in web dynpro i.e. re-using views/methods/nodes of one WD component in another.

Question 4: What is a Custom Controller?
When your Component Controller grows big in size ( say more than 10-15 views and corresponding
context nodes , methods , events , event handlers etc) , it might become tough to handle everything
in the Component Controller . In such a scenario , you can create one or more custom controllers
and modularize or segregate the logic into separate parts using Custom Controller.

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:

To create an interface node , set the interface property to yes as shown in the screenshot to the right : 

Interface node in Interface controller
Interface Node in Webdynpro ABAP 
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:
Interface Node in Webdynpro ABAP
Interface Node in Webdynpro ABAP


Question 8: When do views become available in the interface Controller ? 
Whenever we embed any view in a window , at the moment that view becomes automatically available to the Interface Controller and shows up as an interface view in the Interface Controller. You do not have to declare a view as an interface view as is the case with interface nodes.


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.

Hook Methods in Web Dynpro:

Question 11:What are Hook Methods in Web Dynpro ABAP ?


Hook methods in webdynpro are standard web dynpro methods that are called at different 
time in the web dynpro lifecycle.These methods are listed in the screenshot below: These 
methods start with WD*.


hook methods in web dynpro
Hook Methods in Webdynpro ABAP


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:



Question 13:Sequence in which web dynpro hook methods are called:

If you want to understand the sequence , put breakpoints in all these methods.Execute
 the web dynpro application , then do some action on the view , then close the application window:

Have a look at how the control passes from component to window and then to view:


1.WDDOINIT                                         ( Component Controller )

2.WDDOINIT                                        ( Window Controller ) --> Handle default method of the window is called.

3.WDDOBEFORENAVIGATION    ( Component Controller )

4.WDDOINIT                                        ( View Controller )


5.WDDOMODIFYVIEW                    ( View Controller )

6.WDDOPOSTPROCESSING            ( Component Controller )


Now view is displayed . Suppose user does some action on the view:

7. WDDOAFTERACTION                  ( View Controller )

8. WDDOBEFOREACTION                ( View Controller )

9. WDDOBEFORENAVIGATION    ( Component Controller )

     WDDOINIT                                       ( View Controller ) is not called this time.

10.WDDOMODIFYVIEW                  ( View Controller )

11.WDPOSTPROCESSING                 ( Component Controller )

View is displayed again.Now close button is clicked on the browser.

12.WDDOEXIT                                      ( View Controller )

13.WDDOEXIT                                      ( Component Controller )

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.


PRE exit: This method is called before WDDOINIT is called.

POST exit: This method is called after WDDOINIT is called.

OVERWRITE exit: In this case , WDDOINIT is not called . Instead , OVERWRITE 
exit method is called.

Pre exit Post exit and overwrite exit methods in web dynpro

1 comment:

Unknown said...

hey christi,
I am taking this course from http://www.wiziq.com/course/8153-sap-web-dynpro-pro-abap-training its a really good one and has worked form me so if you have any question regarding this course you can ask me .