Sap Abap Oops Interview Questions.docx

  • Uploaded by: rohan
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Sap Abap Oops Interview Questions.docx as PDF for free.

More details

  • Words: 4,012
  • Pages: 18
SAP ABAP OOPS Interview Questions1. What is Abstract Class Abstract class is a Special kind of class which cannot be instantiated. We can only instantiate the sub class if they are not abstract class. Abstract class should have atleast one abstract method. Abstract method are method without implementation only a declaration. We can certainly define the variables referencing to Abstract class and instantiate with specific subclass at runtime Example-

2. What is an Interface? An interface is not a class. It is an entity which can’t have implementation. An interface can only contain empty method declaration and components. Interface components are always public. We can later change the visibility of the components within the implementing class using the ALIASES. Example-

Sensitivity: Internal & Restricted

3. Differences between Abstract and Interface.  

 

Multiple Inheritance: We can achieve multiple inheritance using Interfaces. Since ABAP doesn’t support more than one Super class, we can have only one abstract class as Super class. New Functionality: If we add a new method in the Interface, all the implementing classes have to implement this method. If we don’t implement the method, it would result into Run-time error. For Abstract class, if we add a non-abstract method, its not required to redefine that in each and every inherited class. Default Behavior: We can have a default behavior of a non-abstract method in abstract class. We can’t have any implementation in Interface as it only contains the empty stub. Visibility: All interface components are PUBLIC by default. For Abstract class, we can set the visibility of each component.

4. What is the Singleton design pattern? The concept of restricting the instantiation of the a class to only and only to one object is called Singleton. As name suggests, it will restrict to create only one instance of a class. The class will have a logic in place which will deny if the application will ask for more than one instance. We can use the CLASS-DATA(static data) to save the created instance within the class and check with that instance, if application asks for a new instance.

Abstract and Final Methods and Classes Abstract and final methods or classes can be defined using the additions ABSTRACT and FINAL of the statements METHODS and CLASS. Abstract methods are declared in abstract classes and cannot be implemented in the same class. They must first be implemented in a subclass of the inheritance tree. Abstract classes cannot, therefore, be instantiated. A non-abstract method is a concrete method. With the exception of the instance constructor, concrete instance methods of a class can also call their abstract methods. Final methods can no longer be redefined in subclasses. They cannot have any additional subclasses and close an inheritance tree definitively. Notes



In classes that are both abstract and final, only the static components can be used. Although instance components can be declared, they cannot be used. Specifying ABSTRACT and FINAL together therefore is useful only for static classes.



Private methods cannot be redefined and can therefore not be abstract.

Sensitivity: Internal & Restricted

Q what is singleton class Q why do we use singleton class? Q. define the concept of multiple inheritance in SAP ABAP Q. what is self-reference Method and how do we call? Operator symbol

ME Operator for self reference call during method. Q. attributes of class (private ,public, protected) Q events handler of class Q. exception handling and types of exception . Q. 7.What

Is The Difference Between Abstract Class And Interface?

29.What is the difference between Abstract method and a Final method ? Q what is Singleton? Q what is type casting? Q. how to achieve the edit and coloring of ALV fields in factory method?

CORE ABAP. DATA DICTIONARYQ. how to validate the input fields when users try to insert char or alphabet in numeric field value. Transaction Codes SE54: Generate Table Maintenance Dialog

SE55: Table view maintenance DDIC call SE56: Table view display DDIC call SE57: Deletion of Table Maintenance SM30: Maintenance Table Views: to define

events we can do using TMG->Environment-

>Modification->Events 01 02 03 04 05 06 07

Before saving the data in the database After saving the data in the database Before deleting the data displayed After deleting the data displayed Creating a new entry After completely performing the function 'Get original' Before correcting the contents of a selected field

Sensitivity: Internal & Restricted

08 09

After correcting the contents of a selected field After getting the original of an entry

Q. if you don’t have any access to put external breakpoint. then how you will be debugging the RFC or service . Using Tcode SRDEBUG we will click on activate Debugger and provide the FM, Class or Method name where we want to put the External debugger. Q. what is search help exit. Basically an enhanced Search help based on requirement to display possible entries when users clicks on F4 button on selection screen. We use to define customer Z FM copy of Standard F4IF_SHLP_EXIT_EXAMPLE and define the changing and tables parameter as SHLP Call-control SHLP_TAB-descriptions RECORD_TAB-structure.

Write the code for F4 help and activate it. Once done then save it in search help exit input screen field. And activate it. Q types of search help. Elementary- Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).

Collective -Collective search helps combine several elementary search helps. Collective search help thus can offer several alternative search paths.

Append Search helpQ some question on enhancement category. The reason for enhancement category is to say what type of fields you can have in your table. For the SAP tables when you want to make enhancements (adding your own fields- append structure) Level Category 1 Unclassified

Meaning The structure does not have an enhancement category.

Sensitivity: Internal & Restricted

2

Cannot be enhanced

The structure must not be enhanced. All structure components and their enhancements must be character-like and flat.

3

Can be enhanced and character-like

4

Can be enhanced and character-like or numeric

All structure components and their enhancements must be flat.

5

Can be enhanced in any way

All structure components and their enhancements can have any data type.

Q. how to move the entry from development to productions.

Using Table entry->Create. Will create the entries and save it in TR. Q why do we use Maintenance view? .

A Maintenance View in SAP ABAP is a view that combines multiple tables into a single view using outer join and is mainly used to maintain multiple tables altogetherTcode is SE54. http://www.teamabap.com/2014/05/maintenance-view.html

Q difference between maintenance view and database view?

In the database view we simply display the scattered data of the application object in one view where as maintenance view allow you to display modify and create the data. A maintenance view permits you to maintain the data of an application object together. Here all the tables in the maintenance view must be linked with a foreign key relationship and join conditions can be formed only using the relationship Q difference between Delivery class and data class.

Sensitivity: Internal & Restricted

The data class determines the tablespace in which a table is created. The database administrator uses tablespaces to organize and maintain the database. Choosing the proper tablespace makes database administration easier, increases system performance, and to some extent even increases system availability because the database is usually taken offline for reorganizations. The delivery class controls the transport of table data when installing or upgrading, in a client copy and when transporting between customer systems. The delivery class is also used in the extended table maintenance. The most important data classes are (other than the system data): APPL0 Master data APPL1 Transaction data APPL2 Organizational and customizing dataMaster data is data which is frequently read, but rarely updated. Following are the delivery classes:



A: Application table (master and transaction data).



C: Customer table, data is maintained by the customer only.



L: Table for storing temporary data.



G: Customer table, SAP may insert new data records, but may not overwrite or delete existing data records. The customer namespace must be defined in table TRESC.



E: System table with its own namespaces for customer entries. The customer namespace must be defined in table TRESC.



S: System table, data changes have the same status as program changes.



W: System table whose data is transported with its own transport objects (e.g. R3TR PROG, R3TR TABL, etc.).

Q. lock object and types of lock.

Lock objects are used to synchronize the multiple set of users who are accessing the same set of data. There are three types of locks. 1. Exclusive Lock. 2. Shared Lock. 3. Exclusive but not cumulative lock.

Sensitivity: Internal & Restricted

Exclusive Lock

The locked data can be read or proceed one user only. A request for another exclusive lock for a shared lock is rejected. Shared Lock

Several users can read the same data at the same time, but as same as a user edits the data,a second user can not longer access this data. Requests for further shared locks are accepted, but exclusive locks are rejected. Exclusive but not cumulative lock.

Exclusive locks can be requested by the same user more than once and handled successfully, but an exclusive but not cumulative lock can only be requested once by a given user, all the other lock requests are rejected. https://www.sapnuts.com/courses/core-abap/open-sql/creating-lock-objects-SAP.html

Q. how to make the test data while in debugging when calling the service and debugging the RFC. While debugging if come across the FM or Class then we can go to tools there we will have the options to save the parameter as Test data.

WEBDYNPRO Q. lead selection in web dynpro

At run time a context node may contain many records , but only one of those is selected .The user can select any record from the Table/ALV/Drop Down/Radio and this selection is called lead selection. 0..1

Any cardinality

Lead selection can be empty. Multiple selection is not possible.

1..1

Any cardinality

As the node selection has to contain exactly one element, the lead selection is always set (provided the node is not empty). Multiple selection is not possible.

0..n

0..n, 1..n only

Multiple selection of elements is possible. The lead selection can be empty.

1..n

1..n only

Multiple selection of elements is possible. The lead selection is set automatically (provided the node is not empty).

Q. selection node and collection node difference

Sensitivity: Internal & Restricted

In the same way that the node's cardinality controls the maximum and minimum number of elements permissible within the node collection at runtime, so the selection cardinality controls the maximum and minimum number of elements that may be selected at any one time. Unless you say otherwise, a node will have a selection cardinality of 0..1 meaning that you may select zero or one element at any one time. If such a node were displayed using a table UI element, you would be able to select only one row at a time. However, if you wish to allow the user to select multiple rows, you will need to change the selection cardinality to 0..n, meaning that zero or more elements may be selected. Selection Cardinality-

It specifies how many records that can be selected from a node.

Collection cardinality-

It specifies how many records that can be stored in a node.

Q. what is Assistance class. Assistance Class in WD is used for storing common reusable logic apart from component controller. It can also be used to store Text Symbols for displaying messages or label’s for the WD application. Per WD session there will be one instance of assistance class ( if mentioned ) will be automatically instantiated and you can access it by wd_assist. It can also be used to store a reusable set of constants, public attributes, types etc. Assistance class has some standard methods like get_text to fetch text from text symbols. To create an assistance class you have to create a normal class and then mention CL_WD_COMPONENT_ASSISTANCE as superclass. Then you can metion you class name in WD Component Header Details.

Q. how to define Message in Webdynpro.?

We can display error, warning, success, attribute error etc messages in Web Dynpro ABAP using interface IF_WD_MESSAGE_MANAGER, when we raise messages using IF_WD_MESSAGE_MANAGER, the messages will be displayed in Message Area UI element, by default Message Area UI element is at the top of the screen. Q. how to define Select-options in webdynpro? The usage of WDR_SELECT_OPTIONS component is defined in the Used Components tab as SELECT_OPTIONS. Define attributes of type IF_WD_SELECT-OPTIONS Interface -- wd_cpifc_select_option

Q how do we use select options in webdynpro? Q ALV in WEBDYNPRO ? SMARTFORM

Sensitivity: Internal & Restricted

SSF_FUNCTION_MODULE_NAME Q. no of main window in smart form Smartform can have only one main window but if we want to create another window we can achieve by custom window. Q. difference between table and loop in smart form. Only difference is table node also provides u a way to format the output using line types, so u can show the output using rows and cells, loop node is used when u dont need to format the output using a table node so in that case only loop node is used.

IDOC AND BDC HOW DO YOU CREATE A CUSTOM IDOC?

Creation of Segment Types Run T-code ‘WE31’ to create segment type Creation of IDoc type Run T-code ‘WE30’ to create custom IDoc type Creation of logical message types Run T-code ‘WE81’ to create the logical message types. Linking Message type and IDoc type. Run T-Code ‘WE82’. Now we have to link these created IDoc types and Message types. 

Control Record — contains control info ex: receiver port etc



Data record — Contains IDOC data



Status — holds IDOC status.

Q. ALE idoc complete process and related tcodes ? Common configurations on both sides: Creating Logical System Names SALE Setup RFC destinations SM59

Sensitivity: Internal & Restricted

Defining Port Destinations WE21

In Source system: Segment Creation WE31 Basic IDOC Type Creation WE30 Message Type Creation WE81 Assign Message Type To Basic IDOC Type WE82 Distribution Model BD64 Writing Report Program SE38 Partner Profile WE20 Message control NACE Check IDOCs WE02, WE05

In Destination System: Creating FM SE37 Assign FM to Logical Message WE57 Define I/P method for Inbound FM BD51 Create Process Code WE42 Generate Partner Profile BD64

Q. BDC difference between call transaction and session Method Q how do you debug Idoc ? ----cap Gemini TCODE WE19 provide the basic type and then inter the inbound function module you will find the checkbox for Call in debug mode.

Sensitivity: Internal & Restricted

Another way is TCODE-Use

transaction BD87 to debug IDOC

concerned. If you find the Function Module with help of process Code of an Error Idoc put a breakpoint and then execute the tcode BD87to debug inserting idoc number.

https://www.sapnuts.com/tutorials/Using-WE19-to-reprocess-IDOC-or-Debugg-IDOC.html Q. how we can find out the error in Idoc?. We02 or we05 Q what is BDC and Types of BDC?

BDC(Batch Data Communication) is a batch interfacing technique which is used to insert mass data into SAP R/3 system, in BDC the data will be loded into R/3 using SAP Screen which we use to create a record(Example: Material in MM01).In simple BDC is a technique in SAP, which is used to upload mass data into R/3 server from a flat file( .txt, Excel etc). In BDC the data will be flowing in SAP R/3 through screens (Ex: MM01), BDC is a inbound process. The BDC can be performed in two methods:  

Call Transaction. Session Method.

In BDC we use structure BDCDATA for Batch Input, which has following components.

    

PROGRAM DYNPRODYNBEGINFNAMFVAL-

BDC module pool BDC Screen number BDC screen start Field name BDC field value

A BDCDATA structure can contain the batch input data for only a single run of a transaction 

In CALL TRANSACTION method, we need to create Log for the Error Message, for this we use structure BDCMSGCOLL.



CALL TRANSACTION 'ME51' USING t_bdcdata MODE w_mode UPDATE 'S' MESSAGES INTO t_msg.

https://www.sapnuts.com/courses/core-abap/bdc/recording-a-transaction-S.html

Sensitivity: Internal & Restricted

Session Method: In Session Method following function Modules are used. 1.

BDC_OPEN_GROUP.

2.

BDC_INSERT.

3.

BDC_CLOSE_GROUP. In BDC we use structure BDCDATA for Batch Input, Which has following components. PROGRAM - BDC module pool DYNPRO-

BDC Screen number

DYNBEGIN-

BDC screen start

FNAM-

Field name

FVAL-

BDC field value

A BDCDATA structure can contain the batch input data for only a single run of a transaction

http://saptechnical.com/Tutorials/ABAP/BDC/Session.htm Q we have header and item details and need to be transport to the SAP system how do we do in BDC? use a single do endo. and two internal tables. do read the dataset into a string, if first two chars are 'HD' pass the string to HEADER internal table elseif first two chars are 'IT' pass the string to ITEM internal table endif. enddo.

Q. what is load of program and initialization do. Q. steps to keep in mind for performance tuning.

1. Using all the keys in SELECT statement.

Sensitivity: Internal & Restricted

2. 3. 4. 5. 6. 7. 8.

Avoid SELECT * Fetching Single Record. Avoid SELECT-ENDSELECT. Using Indexes. Avoid “INTO CORRESPONDING” SELECT statement inside LOOP. Nested SELECT statement. 9.

ST05 is the performance trace. It contain the SQL Trace plus RFC, enqueue and buffer trace. Mainly the SQL trace is is used to measure the performance of the select statements of the program.

10. SE30 is the Runtime Analysis transaction and can be used to measure the application performance. 11. SAT transaction is the replacement of the pretty outdated SE30. Provides same functionality as SE30 plus some additional features. 12. ST12 transaction (part of ST-A/PI software component) is a combination of ST05 and SAT. Very powerful performance analysis tool used primarily by SAP Support. 13. One of the best tools for static performance analyzing is Code Inspector (SCI). There are many options for finding common mistakes and possible performance bottlenecks.

14.

Q techniques used for performance tuning Q why do we use for all Entries and checks to keep in mind while using for all entries For all entries we use in place of table joins, make sure the first table is not initial before appending with use of for all entries in another IT.

ENHANCEMENTS Q. types of BADI and which one you use it in your project

BADI (Business Add-in)    

BADI is another way of implementing enhancements to the standard programs with out modifying the original code. BADI's are implemented using oo programming technique Technically a BADI is nothing but an interface. Each BADI consists of the method with out implementation called as BADI definition. We need to create classes to write the abap code by implementing the methods called as BADI implementation.

SE18 is the T-code for BADI definition, SE19 is the T-code for BADI implementation.

Sensitivity: Internal & Restricted

Advantages of BADI   

The main advantage of using BADI's is , we can create multiple implementations for a single BADI definition. Where as with the exits, we can create a single implementation.i.e a single project for a enhancement. We cannot create another project (implementation) for enhancement which is already used. That is why we go for BADI's.

Types of BADI   

Single implementation BADI. Multiple implementation BADI. Filter BADI.

Single implementation BADI:- A BADI which has only one implementation (single class) is called single implementation BADI. Multiple implementation BADI:- A BADI which has multiple implementations is called multiple implementation BADI. By default all the implementations will be executed. We cannot control the sequence of execution of multiple implementations. Filter BADI It is type of BADI which has a filter value so that only those implementations which satisfy the filter value are executed. The remaining implementations are not executed this type of BADI is called a filter BADI. Properties of BADI

Sensitivity: Internal & Restricted

   

If WITH IN SAP checkbox is selected then this BADI is only used by sap. If multiple use checkbox is selected then it is a multiple implementation BADI. If multiple use checkbox is not selected then it is a single implementation BADI. If filter dependent checkbox is selected then it is filter dependent BADI. We need to specify the filter type such as land1, bukrs, werks. for the filter BADI.

Q difference between kernel and classical badis With classic BAdIs, a BAdI object is created by calling a factory method, and referenced via a reference variable of the type of the BAdI interface. With new BAdIs, a BAdI object is created via the ABAP statement GET BADIas a handle for the calls of BAdI methods by CALL BADI, referenced via a reference variable of the type of the BAdI.

Classic BAdI Calling :

DATA:bd TYPE REFTOif_intf. DATA:flt TYPE flt. CALLMETHODcl_exithandler=>get_instance EXPORTING exit_name=`BADI_NAME` CHANGING instance=bd. flt-lang=`D`. CALL METHOD bd->method EXPORTING x=10

Sensitivity: Internal & Restricted

flt_val=flt.

Q which BADi is more faster kernel or classical. KERNEL BADI Q how you use multiple BADI, do we need to deactivate or you can activate all implementations. A BADI that has the multiple use checkbox ticked simply means that you can not only create multiple instances but also have more than 1 of them active at the same time. This is unlike a standard BADI without the multiple use option ticked, which can only have one implementation active at any one time. There is however one caveat to multiple use badi’s, although you can have multiple implementations you can’t specify which order these will be fired in. Therefore, each implementation needs to be coded as a separate entity and must not rely on a specific execution sequence or another one being completed first i.e. you could not have one performing some checks and another updating a database based on these checks. Q. what is function exit?-Customer Exit—Using tcode SMOD and CMOD, we can find the exit using search options in Main Program but Text CALL-CUSTOMER FUNCTION, SCREEN. In SMOD you can find the Exist available for particular standard program of Tcode using Package. In CMOD we can create project and Implement the Exist using enhancement assignment and Q. what is implicit and explicit enhancement?. Implicit Enhancement- Were we can add our code to standard program beginning and end of form and end form under include. go to edit -> Enhancement Operations -> Show Implicit....Q. what is kernel BADI?

Q. what is enhancement section? Enhancement section is used to replace a set of code or statements with the customer (custom code)

Q. how do we find the BADI steps?

Sensitivity: Internal & Restricted

CL_EXITHANDLER- GET INSTANCE copy the EXIT name and find the proper BADI to implement. MODULE POOL Q. events in Module Pool?

There are four events available in module pool programming. PBO (Process Before Output): Triggered before MPP screen is displayed. PAI (Process After Input): Triggered after MPP screen is displayed whenever user raises an action. Also,Now PBO is also triggered. POV (Process On Value Request): Triggered when User Clicks on search help or F4 Button. POH (Process On Help Request): Triggered when User Clicks on search help F1 function key

Q. CHAIN ENDCHAIN.? If u want to validate more than one field u can do that by using CHAIN ENDCHAIN concept. i'm placing a example where i've used chain endchain concept. i wrote it in PAI of my code to validate userid and paswrd chain. field zempdetails-empno. field zempdetails-password. MODULE USER_COMMAND_0100. endchain. all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again

Sensitivity: Internal & Restricted

Sensitivity: Internal & Restricted

Related Documents

Sap Abap Reports
June 2020 12
Sap Abap Tc Ngbendale
October 2019 15
Sap Abap Questions
June 2020 9
Abap Interview Questions
October 2019 12

More Documents from ""