SAP Web Dynpro ABAP Interview Questions With Answers

Download SAP Web Dynpro ABAP Interview Questions With Answers

Post on 13-Oct-2015

596 views

Category:

Documents

2 download

Embed Size (px)

DESCRIPTION

SAP Web Dynpro ABAP Interview Questions With Answers

TRANSCRIPT

SAP Web Dynpro ABAP Interview Questions with AnswersControllers 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

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 TopInclude 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 ofone 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:

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:

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 its 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 Webdynprodevelopment 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 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? ORWhat 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.

Question 16:What is an Assistance class in webdynpro ABAP? Where do you define an assistance class? How many assistance classes can a webdynpro component have?Assistance class helps you achieve two things:1) Segregation of business specific logic (one of the purpose of MVC).2) Performance benefit.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 haveonly oneassistance classand 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 attributewd_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 nodewith cardinality 0n )onSingletonNodeby clicking on the link. This is not that tough , just spend some time with it and you should be okay.The best way to answer this question is by taking an example.Say there are two ALVs on a View:ALV1 >NODE_SO_HEADER->Displays all the Sales Orders.ALV2 >NODE_SO_ITEMS >Displays all the line items for the Sales Order selected in ALV1.NODE_SO_ITEMS is the child node for NODE_SO_HEADER and is declared as Singleton node.Since this node is declared as singleton , at runtime , it holds the line item data only for the Lead Selected Sales Order from NODE_SO_HEADER and not for all the Sales Orders from the parent node.Whenever the lead selection changes for the parent node, line item data for that lead selected order is fetched from database and populated in the child node.As a result great performance optimization is achieved.I hope you get this one :).Question 18:What is a supply function? When is it called?You can assign a supply function to a context node when you create a node. In simple terms, supply function is used to populate data records in the context node. A supply function is called when one or more elements of the node are accessed for the first time.

Supply function in web dynpro

To give you an analogy, we all know that a constructor method of a class is called whenever an object of that class is instantiated. In the same way, a supply function for a context node is called when the node is accessed for the first time.

The supply function is generally used in combination with singleton nodes.So whenever the lead selection of the parent node changes , the supply function of the singleton node recalculates and repopulates the child node.Question 19:What is lead selection? Is it an event?Yes , the lead selection is an event in web dynpro.At run time a context node may contain many records , but only one of t