Monday, May 27, 2013

SAP ABAP interview Questions & Answers (Part 1)

First 50 Interview Questions that I have faced in the Interviews.
The very first question everyone asks is tell me in which area you have worked in SAP ABAP. Try to consume as much time as you can because the next few minutes to few hours, the interviewer is going to spent on that.
1.      What is the difference between data element and domain?
Domain contains the technical definition of the field. It contains the type, length, range of the data field. Data element contains the semantic definition. It contains the short definition (meaning of the field in relation to business), field labels.
2.       Difference between Value table & Check table.
The field value range can be defined using value table in domain level. But validation does not occur until a foreign key is defined. Then the table becomes check table. Value table is just a proposal and if we accept it, it becomes our check table.
3.       Events in interactive reports.
Apart from normal events like Initialization, At selection screen, Start of selection, Top of page, End of page, End of selection the specific events that are there are:
Top of page during line selection: Using this event we can give the standard Header in the secondary list.
At line-selection: Using this event we can navigate the primary list into the secondary list.
At pF: function key from F5 to F12 to perform interactive action on the list. 
At user-command: It’s a user action command.
4.       How many kinds of tables are there?
Tables can be Transparent, Pool or Cluster. When the transparent table gets activated a table with the same name gets created in the database. In database the table name and field name remains same but the data types gets converted to corresponding database types. Functionally dependent data from certain tables can be stored in database as a cluster table with key as the intersection of table cluster keys. Tables with storage data that are not dependent on each other can be saved as Pool table in database with key as the concatenated value of the table name and key field. This is done so that the data stored in compressed form and database load gets reduced.
(Step by step procedure of these tables creation: http://debesh-exploringfacts.blogspot.in/2013/02/sap-data-dictionary.html)

5.       Difference between call transaction and session method.
If data volume is high we go for session else call transaction will do. The system executes a database commit immediately before and after the 'CALL TRANSACTION USING' statement whereas for the session method it goes for Asynchronous processing. During processing, no transaction is started until the previous transaction has been written to the database. In Session method no sy-subrc is returned, error log is created for error records, updation is always synchronous. Whereas in Call Transaction Method, immediate updation in the database table occurs, sy-subrc is returned, error need to be handled explicitly, updation can be synchronous as well as asynchronous.

6.       How do you write a field for input help on a selection screen with multiple discrete entries?
Select option with no interval.
7.       Syntax for join query.
If I need to use field A, B, Z from table X and C, D, Z from table Y
Select P~A   P~B   P~Z Q~C Q~D Q~Z from table X as P inner join table Y as Q on P~Z = Q~Z where .
(The interviewer didn’t asked this question directly. Rather he gave me two tables and told me to write code to extract the fields into a single table. I wrote the code using for all entries .Then he specifically asked in what other way you can do it)
8.       Difference between a table and a structure.
For table there is a corresponding object in database where no corresponding object is there for structure. Table can hold data whereas structure can’t hold data.
9.       Difference between RFC enabled function module and BAPI.
Technically speaking, both are remote enabled functions that can be accessed from outside of SAP. The difference between RFC and BAPI are business objects. Business Application Programming Interfaces (BAPIs) are standardized programming interfaces that provide external access to SAP business processes and data.  For an RFC to be available and used as a BAPI, it has to be registered in BOR as a method of a business object .
10.   Which one is better in select query when I use something equals to SPACE or not equals to ‘X’ in where condition?(Both give the same results)
Negations in the WHERE condition will usually prevent the optimizer from considering the field in question when searching for a suitable index. This makes it impossible to find a suitable search range, determining the corresponding hit-list can become very processing-intensive, resulting in long runtimes. Negations involving fields that are not contained in the index do not pose a problem.
11.    What is secondary Index?
When a table is activated, an index that is formed from all the key fields is created in addition to the table itself. This index is called the primary index. It is unique by definition.If the primary index cannot be used to determine selection result, (for example, the WHERE condition does not contain any primary index fields), the system searches the whole table. To prevent this, and determine the selection result by searching through a restricted number of database records, we create a secondary index.
12.   How to use RFC enabled FM?
RFC is bidirectional, using this SAP one can interact with external programs or vice versa. To use this one has to define RFC destination in SM59. The calling system while calling the FM also uses this destination in the call signature. The called system simply uses this.
13.   How many kinds of search help are there?
Mainly 2 types of search help are there.
Elementary Search Help: It defines the standard flow of an input help. It holds  
-- Selection method (where does the data displayed in the hit list come from)
-- Search helps parameters (what information should be displayed in the dialog box for value selection and in the hit list)
-- Dialog behavior (what dialog steps should be executed in the input help)

Collective Search Help: It combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help. An append search help is used to enhance a collective search help 
(Detailed procedure to create search helps:
14.   Specific event for ALV?
Few events that are returned from 'REUSE_ALV_EVENTS_GET' are:
1. SLIS_EV_USER_COMMAND<=>USER_COMMAND
2. SLIS_EV_TOP_OF_PAGE<=>TOP_OF_PAGE
3. SLIS_EV_PF_STATUS_SET<=>PF_STATUS_SET
4. SLIS_EV_LIST_MODIFY<=>LIST_MODIFY
5. SLIS_EV_TOP_OF_LIST<=>TOP_OF_LIST
6. SLIS_EV_SUBTOTAL_TEXT<=>SUBTOTAL_TEXT
15.   How to make a cell editable in ALV?
In the field catalogue - don't set the edit property for the field.
Add a table for cell style type lvc_t_style to your list data table.
Now loop the list. When the field match occurs make the style enable and modify the grid table.
16.   Is it possible to display something in hierarchy in ALV? If not how will you do it?
REUSE_ALV_HIERSEQ_LIST_DISPLAY is used for the purpose.
(During my interview I didn’t have any idea about this FM. So I said NO. I answered that I can do it using parallel cursor where I have to loop the header table and display header and on change of header key field I have to loop the item table. Neither me nor the Interviewer are satisfied fully with the answerL)
17.   Tcode for SAP script?
SE71
18.   How to translate a text in script?
This can be done from SE63. There we have to go to the path translation->ABAP Objects->Other Long Text->Form. There we have to assign source and target language.
19.   How many secondary index, include structure, append structure possible for a table?
 There is no limit to create secondary indexes. There can be more than one append structure/include structure. (I did not know the exact answer; somewhere I found the answer 9. I will test this soon)
20.   What is the syntax for call transaction?
call transaction
using BDCDATA(STRUCTURE FOR DATA UPDATE)
UPDATE A/S(A=ASYNCHORONOUS ,S=SYNCHORONOUS)
MODE A/N/E(ALL DISPLAY,NO DISPLAY,ERROR DISPLAY)
MESSAGE INTO BDCMSGCOLL(STRUCTUR E FOR MESSAGES)
program->program name
dynpro->screen number
dynbegin->bdc screen start
fname->fieldname
fval ->field value 
21.   How to display an ALV table using OOPs concept?
First we need to create a container. Then create grid inside container.
For field catalog we have to use LVC_FIELD_CATALOG_MERGE and to display we use SET_TABLE_FOR_FIRST_DISPLAY.
(Link to the program:
22.   What is the structure of BDC data?
BDC DATA structure

23.   What are events in table maintenance?
While maintaining table entries there is a need of updation or change of certain fields in the background, that time we use events in TMG. After creating TMG for the table we need to follow the path Environment -> Modification -> Events .There we can choose any existing event or create a new one. If we create a new one then we have to write the logic for that in a subroutine which gets created in the function group assigned.
24.   What is a function group? When you have used it in your projects?
Function groups are containers for function modules. You cannot execute a function group. When you call a function module, the system loads the whole of its function group into the internal session of the calling program (if it has not already been loaded). Function group creates two includes with UXX and TOP (UXX contains all function modules names in that function group; TOP contains all global declaration of the function group). Also when we create TMG we need to assign a function group so that the TMG screens get saved there.
25.   What is a lock object?
Lock objects are use in SAP to avoid the inconsistency at the time of data is being insert/change into database. When you create a lock object System automatically creat two function module.
1. ENQUEUE_. to insert the object in a queue.
2. DEQUEUE_. To remove the object is being queued through above FM.
(For details:
26.   Explain about parameter ID.
Parameter Id is the one which holds the memory for the particular field. When we need to pass the field from one screen to another use the parameter Id.

The SAP Memory is a user-specific memory area of the application server, which is accessed by all main sessions of a user session at once. We can give value of variable to parameter ID. This will store value in SAP memory
SET PARAMETER ID FIELD .
GET PARAMETER ID FIELD .
27.   What is a type group?
 A TYPE GROUP /TYPE-POOL can be used as 'TEMPLATE' - which contains set of constants, Types, Includes.
28.   What are the visibility levels are there in OOPs concept?
Private, Public, Protected
29.   How many types of views are there?
Database views are implemented with an equivalent view on the database.
- Projection views are used to hide fields of a table (only projection).
- Help views can be used as selection method in search helps.
- Maintenance views permit you to maintain the data distributed on several tables for one application object at one time.
(For details:
30.   Name some tables that you have used in SD.
VBAK, VBAP, LIKP, LIPS, VBRK, VBRP
31.   Where in module pool table control is called?
In both PBO and PAI.
32.   How to use POV event?
The POV (Process on Value request) event is triggered when user clicks F4 function key. 
F4IF_INT_TABLE_VALUE_REQUEST can be used there.
(Link:
33.   What steps you should follow when using for all entries in select query?
The internal table used in for entries clause should not be entry and the duplicate records should be deleted from it based on where condition field.
34.   Syntax for Read statement?
Sort by .
Read table   into with key = binary search.
In binary search, it split the table and checks the extreme values.
35.   How many kinds of windows are there in SMARTFORMS?
Main Window, Secondary Window, Constant Window, Final Window
36.   How to find a BAdI?
Can be searched directly using package or using Get_Instance method of class Cl_Exit_handler.
(Link :
37.   What is a class constructor?
Class constructor is a static constructor which gets automatically accessed when system accesses the class for the first time.
38.   What are final class, abstract Class and assistance class?
Abstract class can’t be instantiated. Abstract class should contain at least one abstract method (method without implementation). The subclass of abstract class can be instantiated if they are not abstract. If wish to create multiple flavors of the object with some default operations, you should consider creating abstract class. Final class can’t be inherited further. All methods of final class are inherently final. Final method can’t be redefined further. If we do not want that, anyone change or override the functionality of that class, we can declare it as final. For each Web Dynpro component, one can create a uniquely assigned assistance class. This class should inherit from the abstract class CL_WD_COMPONENT_ASSISTANCE. The assistance class is automatically instantiated when a component is called. The instance is available to each controller of the component through the attribute WD_ASSIST.
39.   Is multiple inheritance possible in SAP ABAP?
As a class can have more than one interface in its definition so multiple inheritance is possible through interface.
40.   Can I access a private method outside a class?
One cannot call the private method directly. To call a private method, one should call a public method first, and then from that method call that private method. There are certain special cases where a class would want access to other classes private attributes and methods in such scenario we can make use of the friends concept in classes.  
41.   Please explain MVC architecture.
MVC stands for Model View Controller.
Model- Generate the application data without caring how to display it.
View – Visualize application data without caring how it was generated
Controller – Bind user and business interaction together.
Thus separating business, display and control logic is explained through MVC.
42.   What are hook methods and name them in the sequence they are called?
(I will use short forms like CC-Component controller, WC-Window Controller, VC- View controller; also I will skip WD from method names)
CC-DOINIT->WC-DOINIT->CC->DOBEFORENAVIGATION->VC-DOINIT->VC-DOMOFIFYVIEW
->CC-POSTPROCESSING->[VIEW GETS DISPLAYED]->VC-DOAFTERACTION->
CC-BEFORENAVIGATION->VC-MODIFYVIEW->CC-POSTPROCESSING->[CHANGED VIEW DISPLAYED]->VC-DOEXIT->CC-DOEXIT->[Application closed]
43.   How to display table in ALV format in WD?
Using component SLVC_WD_TABLE.
44.   Where to change the layout of a view in runtime in WD?
To make changes to the structure of a view layout, you must use the method WDDOMODIFYVIEW (or a method called within it).
45.   What is supply function in WD?
It is used to populate the child node in webdynpro application.
46.   How will you export a variable from one view to other?
Can be done using export parameters in outbound plug.
47.   What fields are there in FM?
Import, Export, Changing, Table, Exception
48.   Which best practices you follow while coding?
49.   What is a Narrowing Cast?
Assigning instance of a subclass back to the instance of super class.
50.   Do you have any idea about authorizations and roles?
Authority check is nothing but the authorization created for specific user or restrictions for users to particular transactions. Created through SU21. SAP Security will create the roles. These are assigned to user IDs creation from SU01.

Apart from ABAP related questions they ask few other questions whose answers they already knew but they try to hear something else.( e.g.  Why do you what to leave your current organization?). They even ask questions like in what way you can contribute to the organization. Anything you want to know? Do you have your breakfast? J

All the very best.
Debesh


27 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. This comment has been removed by a blog administrator.

    ReplyDelete
  13. This comment has been removed by a blog administrator.

    ReplyDelete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
  15. This comment has been removed by a blog administrator.

    ReplyDelete
  16. This comment has been removed by a blog administrator.

    ReplyDelete
  17. This comment has been removed by a blog administrator.

    ReplyDelete
  18. This comment has been removed by a blog administrator.

    ReplyDelete
  19. This comment has been removed by a blog administrator.

    ReplyDelete
  20. This comment has been removed by a blog administrator.

    ReplyDelete
  21. really a fabulous blog all the questions are very useful, thanks for sharing............

    ReplyDelete
  22. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.

    SAP FICO Training in Chennai

    SAP MM Training in Chennai

    ReplyDelete
  23. Thank you so much for sharing this question and answers.
    sap abap training in hyderabad

    ReplyDelete
  24. thanks for sharing interview questions by https://careergurus.in/sap-abap-training-in-hyderabad-by-careergurus/

    ReplyDelete