Saturday, January 8, 2011

ABAP Performance Tunning


ABAP  Performance Tunning

For all entries

Nested selects

Select using JOINS

Use the selection criteria

Use the aggregated functions

Select with view

Select with index support

Never use Select * if all the table fields are not required

Select with selection list

Key access to multiple lines

Tools available in SAP to pin-point a performance problem
  • SE30 - ABAP run time analysis
  • ST02 - Tune Summary.
  • ST03 - Workload Analysis (Tuning of buffers,.
  • ST04 - Database Performance Analysis.
  • ST05 - Performance Analysis (SQL Trace, etc).
  • ST06 - Operating System monitor.
  • ST07 - Application Monitor.
  • ST14 - Application Analysis.

For all entries


The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
The plus
•    Large amount of data
•    Mixing processing and reading of data
•    Fast internal reprocessing of data
•    Fast
The Minus
•    Difficult to program/understand
•    Memory could be critical (use FREE or PACKAGE size)
Some steps that might make FOR ALL ENTRIES more efficient:
•    Removing duplicates from the the driver table
•    Sorting the driver table
•    If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
•    FOR ALL ENTRIES IN i_tab
•      WHERE mykey >= i_tab-low and
•            mykey <= i_tab-high.
Nested selects
The plus:
•    Small amount of data
•    Mixing processing and reading of data
•    Easy to code - and understand
The minus:
•    Large amount of data
•    when mixed processing isn’t needed
•    Performance killer no. 1

Select using JOINS

The plus
•    Very large amount of data
•    Similar to Nested selects - when the accesses are planned by the programmer
•    In some cases the fastest
•    Not so memory critical
The minus
•    Very difficult to program/understand
•    Mixing processing and reading of data not possible

Use the selection criteria

SELECT * FROM SBOOK.                   
  CHECK: SBOOK-CARRID = 'LH' AND       
                  SBOOK-CONNID = '0400'.        
ENDSELECT.                             
SELECT * FROM SBOOK                     
  WHERE CARRID = 'LH' AND               
        CONNID = '0400'.                
ENDSELECT.                              

Use the aggregated functions

C4A = '000'.              
SELECT * FROM T100        
  WHERE SPRSL = 'D' AND   
        ARBGB = '00'.     
  CHECK: T100-MSGNR > C4A.
  C4A = T100-MSGNR.       
ENDSELECT.                

SELECT MAX( MSGNR ) FROM T100 INTO C4A 
 WHERE SPRSL = 'D' AND                
       ARBGB = '00'.                  

Select with view

SELECT * FROM DD01L                    
  WHERE DOMNAME LIKE 'CHAR%'           
        AND AS4LOCAL = 'A'.            
  SELECT SINGLE * FROM DD01T           
    WHERE   DOMNAME    = DD01L-DOMNAME 
        AND AS4LOCAL   = 'A'           
        AND AS4VERS    = DD01L-AS4VERS 
        AND DDLANGUAGE = SY-LANGU.     
ENDSELECT.                             

SELECT * FROM DD01V                    
 WHERE DOMNAME LIKE 'CHAR%'           
       AND DDLANGUAGE = SY-LANGU.     
ENDSELECT.                             

Select with index support

SELECT * FROM T100            
 WHERE     ARBGB = '00'      
       AND MSGNR = '999'.    
ENDSELECT.                    

SELECT * FROM T002.             
  SELECT * FROM T100            
    WHERE     SPRSL = T002-SPRAS
          AND ARBGB = '00'      
          AND MSGNR = '999'.    
  ENDSELECT.                    
ENDSELECT.                      

Select … Into table

REFRESH X006.                 
SELECT * FROM T006 INTO X006. 
  APPEND X006.                
ENDSELECT

SELECT * FROM T006 INTO TABLE X006.

Select with selection list

SELECT * FROM DD01L              
  WHERE DOMNAME LIKE 'CHAR%'     
        AND AS4LOCAL = 'A'.      
ENDSELECT

SELECT DOMNAME FROM DD01L    
 INTO DD01L-DOMNAME         
 WHERE DOMNAME LIKE 'CHAR%' 
       AND AS4LOCAL = 'A'.  
ENDSELECT

Key access to multiple lines

LOOP AT TAB.          
 CHECK TAB-K = KVAL. 
 " ...               
ENDLOOP.              

LOOP AT TAB WHERE K = KVAL.     
  " ...                         
ENDLOOP.                        

Copying internal tables

REFRESH TAB_DEST.              
LOOP AT TAB_SRC INTO TAB_DEST. 
  APPEND TAB_DEST.             
ENDLOOP.                       

TAB_DEST[] = TAB_SRC[].
Modifying a set of lines
LOOP AT TAB.             
  IF TAB-FLAG IS INITIAL.
    TAB-FLAG = 'X'.      
  ENDIF.                 
  MODIFY TAB.            
ENDLOOP.                 

TAB-FLAG = 'X'.                  
MODIFY TAB TRANSPORTING FLAG     
           WHERE FLAG IS INITIAL.

Deleting a sequence of lines

DO 101 TIMES.               
  DELETE TAB_DEST INDEX 450.
ENDDO.                      

DELETE TAB_DEST FROM 450 TO 550.

Linear search vs. binary
READ TABLE TAB WITH KEY K = 'X'.

READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.

Comparison of internal tables

DESCRIBE TABLE: TAB1 LINES L1,      
                TAB2 LINES L2.      
                                    
IF L1 <> L2.                        
  TAB_DIFFERENT = 'X'.              
ELSE.                               
  TAB_DIFFERENT = SPACE.            
  LOOP AT TAB1.                     
    READ TABLE TAB2 INDEX SY-TABIX. 
    IF TAB1 <> TAB2.                
      TAB_DIFFERENT = 'X'. EXIT.    
    ENDIF.                          
  ENDLOOP.                          
ENDIF.                              
                                    
IF TAB_DIFFERENT = SPACE.           
  " ...                             
ENDIF.                              

IF TAB1[] = TAB2[].  
 " ...              
ENDIF.               
Modify selected components
LOOP AT TAB.           
 TAB-DATE = SY-DATUM. 
 MODIFY TAB.          
ENDLOOP.               

WA-DATE = SY-DATUM.                    
LOOP AT TAB.                           
 MODIFY TAB FROM WA TRANSPORTING DATE.
ENDLOOP.                               
Appending two internal tables
LOOP AT TAB_SRC.              
  APPEND TAB_SRC TO TAB_DEST. 
ENDLOOP

APPEND LINES OF TAB_SRC TO TAB_DEST.

Deleting a set of lines

LOOP AT TAB_DEST WHERE K = KVAL. 
  DELETE TAB_DEST.               
ENDLOOP

DELETE TAB_DEST WHERE K = KVAL.

Tools available in SAP to pin-point a performance problem
•    The runtime analysis (SE30)
•    SQL Trace (ST05)
•    Tips and Tricks tool
•    The performance database


Optimizing the load of the database

Using table buffering
Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are:
•    Select DISTINCT
•    ORDER BY / GROUP BY / HAVING clause
•    Any WHERE clasuse that contains a subquery or IS NULL expression
•    JOIN s
•    A SELECT... FOR UPDATE

If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECR clause.
Use the ABAP SORT Clause Instead of ORDER BY
The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server.
If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it.
Avoid ther SELECT DISTINCT Statement
As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows.

TIPS & TRICKS FOR OPTIMIZATION

•    Use the GET RUN TIME command to help evaluate performance. It's hard to know whether that optimization technique REALLY helps unless you test it out. Using this tool can help you know what is effective, under what kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so you should use it to test small pieces of your program, rather than the whole program.
•    Generally, try to reduce I/O first, then memory, then CPU activity. I/O operations that read/write to hard disk are always the most expensive operations. Memory, if not controlled, may have to be written to swap space on the hard disk, which therefore increases your I/O read/writes to disk. CPU activity can be reduced by careful program design, and by using commands such as SUM (SQL) and COLLECT (ABAP/4).
•    Avoid 'SELECT *', especially in tables that have a lot of fields. Use SELECT A B C INTO instead, so that fields are only read if they are used. This can make a very big difference.
•    Field-groups can be useful for multi-level sorting and displaying. However, they write their data to the system's paging space, rather than to memory (internal tables use memory). For this reason, field-groups are only appropriate for processing large lists (e.g. over 50,000 records). If you have large lists, you should work with the systems administrator to decide the maximum amount of RAM your program should use, and from that, calculate how much space your lists will use. Then you can decide whether to write the data to memory or swap space.
•    Use as many table keys as possible in the WHERE part of your select statements.
•    Whenever possible, design the program to access a relatively constant number of records (for instance, if you only access the transactions for one month, then there probably will be a reasonable range, like 1200-1800, for the number of transactions inputted within that month). Then use a SELECT A B C INTO TABLE ITAB statement.
•    Get a good idea of how many records you will be accessing. Log into your productive system, and use SE80 -> Dictionary Objects (press Edit), enter the table name you want to see, and press Display. Go To Utilities -> Table Contents to query the table contents and see the number of records. This is extremely useful in optimizing a program's memory allocation.
•    Try to make the user interface such that the program gradually unfolds more information to the user, rather than giving a huge list of information all at once to the user.
•    Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to be accessing. If the number of records exceeds NUM_RECS, the data will be kept in swap space (not memory).
•    Use SELECT A B C INTO TABLE ITAB whenever possible. This will read all of the records into the itab in one operation, rather than repeated operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement. Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the number of records you expect to access.
•    If the number of records you are reading is constantly growing, you may be able to break it into chunks of relatively constant size. For instance, if you have to read all records from 1991 to present, you can break it into quarters, and read all records one quarter at a time. This will reduce I/O operations. Test extensively with GET RUN TIME when using this method.
•    Know how to use the 'collect' command. It can be very efficient.
•    Use the SELECT SINGLE command whenever possible.
•    Many tables contain totals fields (such as monthly expense totals). Use these avoid wasting resources by calculating a total that has already been calculated and stored.
ABAP/4 Development Code Efficiency Guidelines
ABAP/4 (Advanced Business Application Programming 4GL) language is an "event-driven", "top-down", well-structured and powerful programming language.  The ABAP/4 processor controls the execution of an event.  Because the ABAP/4 language incorporates many "event" keywords and these keywords need not be in any specific order in the code, it is wise to implement in-house ABAP/4 coding standards.
SAP-recommended customer-specific ABAP/4 development guidelines can be found in the SAP-documentation.
This page contains some general guidelines for efficient ABAP/4 Program Development that should be considered to improve the systems performance on the following areas:-
Physical I/O - data must be read from and written into I/O devices. This can be a potential bottle neck. A well configured system always runs 'I/O-bound' - the performance of the I/O dictates the overall performance.
Memory consumption of the database resources eg. buffers, etc.
CPU consumption on the database and application servers
Network communication - not critical for little data volumes, becomes a bottle neck when large volumes are transferred.
Policies and procedures can also be put into place so that every SAP-customer development object is thoroughly reviewed (quality – program correctness as well as code-efficiency) prior to promoting the object to the SAP-production system.   Information on the SAP R/3 ABAP/4 Development Workbench programming tools and its features can be found on the SAP Public Web-Server.


CLASSIC GOOD 4GL PROGRAMMING CODE-PRACTICES GUIDELINES

Avoid dead-code
Remove unnecessary code and redundant processing
Spend time documenting and adopt good change control practices
Spend adequate time anayzing business requirements, process flows, data-structures and data-model
Quality assurance is key: plan and execute a good test plan and testing methodology
Experience counts


SELECT * FROM <TABLE>
 CHECK:  <CONDITION>
ENDSELECT
  vs.
SELECT * FROM <TABLE>
 WHERE <CONDITION>
ENDSELECT
 
In order to keep the amount of data which is relevant to the query the hit set small, avoid using SELECT+CHECK statements wherever possible. As a general rule of thumb, always specify all known conditions in the WHERE clause (if possible). If there is no WHERE clause the DBMS has no chance to make optimizations.  Always specify your conditions in the Where-clause instead of checking them yourself with check-statements.  The database system can also potentially make use a database index (if possible) for greater efficiency resulting in less load on the database server and considerably less load on the network traffic as well.
Also, it is important to use EQ (=) in the WHERE clause wherever possible, and analyze the SQL-statement for the optimum path the database optimizer will utilize via SQL-trace when necessary.
Also, ensure careful usage of  "OR", "NOT"  and value range tables (INTTAB) that are used inappropriately in Open SQL statements.

SELECT *
 vs.
SELECT SINGLE *

If you are interested in exactly one row of a database table or view, use the SELECT SINGLE statement instead of a SELECT * statement.  SELECT SINGLE requires one communication with the database system whereas SELECT * requires two.
--------------------------------------------------------------------------------
SELECT * FROM <TABLE>  INTO <INT-TAB>
 APPEND <INT-TAB>
ENDSELECT
 vs.
SELECT * FROM <TABLE> INTO TABLE <INT-TAB>
 
It is usually faster to use the INTO TABLE version of a SELECT statement than to use APPEND statements
--------------------------------------------------------------------------------

SELECT ... WHERE + CHECK
 vs.
SELECT using aggregate function

If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates within the program.   The RDBMS is responsible for aggregated computations instead of transferring large amount of data to the application. Overall Network, Application-server and Database load is also considerably less.
--------------------------------------------------------------------------------
SELECT INTO TABLE <INT-TAB> + LOOP AT T
  …………
SELECT * FROM <TABLE> INTO TABLE <INT-TAB>.
LOOP AT <INT-TAB>.
ENDLOOP.
 vs.
SELECT * FROM <TABLE>
    ……….
ENDSELECT
If you process your data only once, use a SELECT-ENDSELECT loop instead of collecting data in an internal table with SELECT ... INTO TABLE.  Internal table handling takes up much more space
--------------------------------------------------------------------------------
Nested SELECT statements:
SELECT * FROM <TABLE-A>
     SELECT * FROM <TABLE-B>
     ……..
     ENDSELECT.

ENDSELECT
 vs.
Select with view

 SELECT * FROM <VIEW>
 ENDSELECT

To process a join, use a view wherever possible instead of nested SELECT statements.
Using nested selects is a technique with low performance. The inner select statement is executed several times which might be an overhead. In addition, fewer data must be transferred if another technique would be used eg. join implemented as a view in ABAP/4 Repository.
• SELECT ... FORM ALL ENTRIES
• Explicit cursor handling (for more information, goto Transaction SE30 – Tips & Tricks)

Nested select:

SELECT * FROM pers WHERE condition.
         SELECT * FROM persproj WHERE person = pers-persnr.
               ... process ...
         ENDSELECT.
ENDSELECT.
 vs.
SELECT persnr FROM pers INTO TABLE ipers WHERE cond.  ……….
SELECT * FROM persproj FOR ALL ENTRIES IN ipers
      WHERE person = ipers-persnr
………... process .……………
ENDSELECT.
In the lower version the new Open SQL statement FOR ALL ENTRIES is used. Prior to the call, all interesting records from 'pers' are read into an internal table. The second SELECT statement results in a call looking like this (ipers containing: P01, P02, P03):
(SELECT * FROM persproj WHERE person = 'P01')
UNION
(SELECT * FROM persproj WHERE person = 'P02')
UNION
(SELECT * FROM persproj WHERE person = 'P03')
In case of large statements, the R/3's database interface divides the statement into several parts and recombines the resulting set to one.  The advantage here is that the number of transfers is minimized and there is minimal restrictions due to the statement size (compare with range tables).

SELECT * FROM <TABLE>
vs.
SELECT <column(s)> FROM <TABLE>

 
Use a select list or a view instead of SELECT *, if you are only interested in specific columns of the table. If only certain fields are needed then only those fields should be read from the database.  Similarly, the number of columns can also be restricted by using a view defined in ABAP/4 Dictionary. Overall database and network load is considerably less.
--------------------------------------------------------------------------------
SELECT without table buffering support
 vs.
SELECT with table buffering support
For all frequently used, read-only(few updates) tables, do attempt to use SAP-buffering for eimproved performance response times. This would reduce the overall Database activity and Network traffic.
--------------------------------------------------------------------------------
Single-line inserts
LOOP AT <INT-TAB>
 INSERT INTO <TABLE> VALUES <INT-TAB>
ENDLOOP
 vs.
Array inserts
Whenever possible, use array operations instead of single-row operations to modify the database tables.
Frequent communication between the application program and database system produces considerable overhead.
--------------------------------------------------------------------------------
Single-line updates
 SELECT * FROM <TABLE>
  <COLUMN-UPDATE STATEMENT>
  UPDATE <TABLE>
 ENDSELECT
 vs.
 
Column updates
 UPDATE <TABLE> SET <COLUMN-UPDATE STATEMENT>
Wherever possible, use column updates instead of single row updates to update your database tables
--------------------------------------------------------------------------------

DO....ENDDO loop with Field-Symbol
 vs.
Using CA operator

Use the special operators CO, CA, CS instead of programming the operations yourself
If ABAP/4 statements are executed per character on long strings, CPU consumprion can rise substantially
--------------------------------------------------------------------------------
Use of a CONCATENATE function module
 vs.
Use of a CONCATENATE statement
Some function modules for string manipulation have become obsolete, and should be replaced by ABAP statements or functions
STRING_CONCATENATE...   ---> CONCATENATE
STRING_SPLIT...  ---> SPLIT
STRING_LENGTH...  ---> strlen()
STRING_CENTER...  ---> WRITE..TO. ..CENTERED
STRING_MOVE_RIGHT  ---> WRITE...TO...RIGHT-JUSTIFIED
--------------------------------------------------------------------------------

Moving with offset
 vs.
Use of the CONCATENATE statement

Use the CONCATENATE statement instead of programming a string concatenation of your own
--------------------------------------------------------------------------------
Use of SEARCH and MOVE with offset
 vs.
 
Use of SPLIT statement
 
Use the SPLIT statement instead of programming a string split yourself
--------------------------------------------------------------------------------
Shifting by SY-FDPOS places
 vs
Using SHIFT...LEFT DELETING LEADING...
If you want ot delete the leading spaces in a string use the ABAP/4 statements SHIFT...LEFT DELETING LEADING...  Other constructions (with CN and SHIFT... BY SY-FDPOS PLACES, with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) ...) are not as fast
--------------------------------------------------------------------------------
Get a check-sum with field length
 vs
Get a check-sum with strlen ()
 
Use the strlen () function to restrict the DO loop to the relevant part of the field, eg. when determinating a check-sum

ABAP CODE OPTIMISATION , PERFORMANCE TUNING


*********************************************************************************

         If you like this click on Recommend this on google + for knowledge sharing 

100 abap interview question

 SAP ABAP interview questions with no answers 😏


   1. What are the various compoents of SAP XI?
   2. Define Integaration Builder.
   3. What is Software Component Version.
   4. Explain IR and ID.
   5. What is data type, message type, Message Interface, etc.
   6. What is context handling?
   7. Context object (How to create and use one).
   8. What are the various steps in the ID for configuration and expain each one.
   9. What are pipe line services?
  10. Define central adapter engine.
  11. What are the various type of Adapter.
  12. Idoc adapter and File adapter.
  13. What are the adapters that exist in the ABAP stack?
  14. Different type of Mapping, their merits?
  15. Define Simple and Advance function, how do we create it?
  16. Overview of the Run Time Workbench.
  17. How you create the Idoc to File or File to Idoc scenerio(Complete Flow).
  18. What are the steps to send the Idoc to XI.
  19. How can you varify that Idoc is sent to the XI or not.
  20. What is Metadata, how can you check the Idoc metadata (t-code IDX2).
  21. What are the Various steps for the Java Mapping?
  22. What is Value Mapping? How we can use it, where does the table get stored?
  23. What is MultiMapping, what interface do we use for it?
  24. Define BPM, their basics steps (Like Fork, Block, Loop, etc.)?
  25. Sender Agreement is required for Idoc adapter? Why?

SAP ABAP frequent questions 


   1. How do you call SAP script in reports & reports in SAP script?
   2. What is different between SAP script & reports?
   3. What is stack?
   4. What is the defination of ALE RFC?
   5. Why is BAPI required? How about BDC?
   6. What happens if I use control break statement in between select & endselect?
   7. What is lock Object
   8. SAP Versions
   9. SAP Platforms
  10. SAP Processes
  11. SAP Modules
  12. SAP Table Name Standard
  13. SAP Vendors
  14. SAP Certification
  15. What is SQL Trace, how would you carry out performance analysis of ABAP code using SQL Trace? Give the steps?
  16. What are the transactions we should use in BDC? How do we use it?
  17. How would you use BDC program to transfer material master record using MM01 transaction? Give me steps.
  18. Could we use ME21N transaction, and XK01 transaction, either which one of the transaction, or could we use both the transactions for creating purchase information.
  19. What is the name of the standard report that gives the deatails of Customer and sales amount?
  20. How can we use XD02 transaction to change the customer data for updating KNA1 table? Give the steps.
  21. How the transaction ME21N is used for to upload the purchase order in BDC?
  22. How many transaction we can used in BDC at a time?
  23. How the data get updated in BDC using transaction.
  24. Why BAPI need then BDC?
  25. What happen if I use controll break statement in between select & endselect?
  26. What is lock Object?
  27. Select option works like _____________ on Selection Screen?
  28. Which sysgtem variable have current value during execution?
  29. What is the main point while using controll bareak in internal table?
  30. Waht is Field sysmbol?
  31. Smartform uses wisely then selection screen, why?
  32. Which one is not an exit comand? (Exit, cencle, stop, back)
  33. Which component gives you better visibility? (pritty Printer)
  34. Explain about roll area, Dispatcher, ABAP-Processor.
  35. What is the final entry in BDC Table?
  36. How can I get output on same page?
  37. Why is Transaction Varient needed?
  38. If I have table control, what is the same code in PBO and PAI?
  39. Who takes care of passing the data to the application server?

SAP/ABAP interview questions


   1. Type of table?
   2. Events of module pool?
   3. Events of interactive report?
   4. Filters & idoc and segments?
   5. Types of enhancements?
   6. Type of partner profile?
   7. What is RFC? What is its purpose?
   8. Steps of LSMW?
   9. Types of BDC? How u proceed BDC(call transaction) without recording?
  10. What is message type in idoc?
  11. What is a dialog program?
  12. What is debugging? How do you proceed the steps in your reports?
  13. What are the parameters passed to fieldcatalog?
  14. What are all the tools used for debugging and run time analysis?
  15. What is the diffrence between watchpoint and breakpoint?
  16. How many watchpoints and breakpoints can be used in each program?
  17. Types of watchpoints and breakpoints?
  18. How do you transfer file from application server to SAP R/3 system?
  19. What is commit and rollback?
  20. Using BDC when uploading the data to database, what are all the fields that the table (BDCDATA) will display?

Update No 1:
SAP ABAP interview questions




   1. What is an ABAP data dictionary?- ABAP 4 data dictionary describes the logical structures of the objects used in application development and shows how they are mapped to the underlying relational database in tables/views.
   2. What are domains and data element?- Domains:Domain is the central object for describing the technical characteristics of an attribute of an business objects. It describes the value range of the field. Data Element: It is used to describe the semantic definition of the table fields like description the field. Data element describes how a field can be displayed to end-user.
   3. What is foreign key relationship?- A relationship which can be defined between tables and must be explicitly defined at field level. Foreign keys are used to ensure the consistency of data. Data entered should be checked against existing data to ensure that there are now contradiction. While defining foreign key relationship cardinality has to be specified. Cardinality mentions how many dependent records or how referenced records are possible.

   4. Describe data classes.- Master data: It is the data which is seldomly changed. Transaction data: It is the data which is often changed. Organization data: It is a customizing data which is entered in the system when the system is configured and is then rarely changed. System data:It is the data which R/3 system needs for itself.
   5. What are indexes?- Indexes are described as a copy of a database table reduced to specific fields. This data exists in sorted form. This sorting form ease fast access to the field of the tables. In order that other fields are also read, a pointer to the associated record of the actual table are included in the index. Yhe indexes are activated along with the table and are created automatically with it in the database.
   6. Difference between transparent tables and pooled tables.- Transparent tables: Transparent tables in the dictionary has a one-to-one relation with the table in database. Its structure corresponds to single database field. Table in the database has the same name as in the dictionary. Transparent table holds application data. Pooled tables. Pooled tables in the dictionary has a many-to-one relation with the table in database. Table in the database has the different name as in the dictionary. Pooled table are stored in table pool at the database level.
   7. What is an ABAP/4 Query?- ABAP/4 Query is a powerful tool to generate simple reports without any coding. ABAP/4 Query can generate the following 3 simple reports: Basic List: It is the simple reports. Statistics: Reports with statistical functions like Average, Percentages. Ranked Lists: For analytical reports. - For creating a ABAP/4 Query, programmer has to create user group and a functional group. Functional group can be created using with or without logical database table. Finally, assign user group to functional group. Finally, create a query on the functional group generated.
   8. What is BDC programming?- Transferring of large/external/legacy data into SAP system using Batch Input programming. Batch input is a automatic procedure referred to as BDC(Batch Data Communications).The central component of the transfer is a queue file which receives the data vie a batch input programs and groups associated data into “sessions”.
   9. What are the functional modules used in sequence in BDC?- These are the 3 functional modules which are used in a sequence to perform a data transfer successfully using BDC programming: BDC_OPEN_GROUP - Parameters like Name of the client, sessions and user name are specified in this functional modules. BDC_INSERT - It is used to insert the data for one transaction into a session. BDC_CLOSE_GROUP - This is used to close the batch input session.
  10. What are internal tables?- Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
  11. What is ITS? What are the merits of ITS?- ITS is a Internet Transaction Server. ITS forms an interface between HTTP server and R/3 system, which converts screen provided data by the R/3 system into HTML documents and vice-versa. Merits of ITS: A complete web transaction can be developed and tested in R/3 system. All transaction components, including those used by the ITS outside the R/3 system at runtime, can be stored in the R/3 system. The advantage of automatic language processing in the R/3 system can be utilized to language-dependent HTML documents at runtime.
  12. What is DynPro?- DynPro is a Dynamic Programming which is a combination of screen and the associated flow logic Screen is also called as DynPro.
  13. What are screen painter and menu painter?- Screen painter: Screen painter is a tool to design and maintain screen and its elements. It allows user to create GUI screens for the transactions. Attributes, layout, filed attributes and flow logic are the elements of Screen painter. Menu painter: Menu painter is a tool to design the interface components. Status, menu bars, menu lists, F-key settings, functions and titles are the components of Menu painters. Screen painter and menu painter both are the graphical interface of an ABAP/4 applications.
  14. What are the components of SAP scripts?- SAP scripts is a word processing tool of SAP which has the following components: Standard text. It is like a standard normal documents. Layout sets. - Layout set consists of the following components: Windows and pages, Paragraph formats, Character formats. Creating forms in the R/3 system. Every layout set consists of Header, paragraph, and character string. ABAP/4 program.
  15. What is ALV programming in ABAP? When is this grid used in ABAP?- ALV is Application List viewer. Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length. In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain up to 90 columns in the display with the wide array of display options.
  16. What are the events in ABAP/4 language?- Initialization, At selection-screen, Start-of-selection, end-of-selection, top-of-page, end-of-page, At line-selection, At user-command, At PF, Get, At New, At LAST, AT END, AT FIRST.
  17. What is CTS and what do you know about it?- The Change and Transport System (CTS) is a tool that helps you to organize development projects in the ABAP Workbench and in Customizing, and then transport the changes between the SAP Systems and clients in your system landscape. This documentation provides you with an overview of how to manage changes with the CTS and essential information on setting up your system and client landscape and deciding on a transport strategy. Read and follow this documentation when planning your development project.
  18. What are logical databases? What are the advantages/ dis-advantages of logical databases?- To read data from a database tables we use logical database. A logical database provides read-only access to a group of related tables to an ABAP/4 program. Advantages: i)check functions which check that user input is complete, correct,and plausible. ii)Meaningful data selection. iii)central authorization checks for database accesses. iv)good read access performance while retaining the hierarchical data view determined by the application logic. dis advantages: i)If you donot specify a logical database in the program attributes,the GET events never occur. ii)There is no ENDGET command,so the code block associated with an event ends with the next event statement (such as another GET or an END-OF-SELECTION).
  19. What is a batch input session?- BATCH INPUT SESSION is an intermediate step between internal table and database table. Data along with the action is stored in session ie data for screen fields, to which screen it is passed, program name behind it, and how next screen is processed.
  20. How to upload data using CATT ?- These are the steps to be followed to Upload data through CATT: Creation of the CATT test case & recording the sample data input. Download of the source file template. Modification of the source file. Upload of the data from the source file.
  21. What is Smart Forms?- Smart Forms allows you to create forms using a graphical design tool with robust functionality, color, and more. Additionally, all new forms developed at SAP will be created with the new Smart Form solution.
  22. How can I make a differentiation between dependent and independent data?- Client dependent or independent transfer requirements include client specific or cross client objects in the change requests. Workbench objects like SAPscripts are client specific, some entries in customizing are client independent. If you display the object list for one change request, and then for each object the object attributes, you will find the flag client specific. If one object in the task list has this flag on, then that transport will be client dependent.
  23. What is the difference between macro and subroutine?- Macros can only be used in the program the are defined in and only after the definition are expanded at compilation / generation. Subroutines (FORM) can be called from both the program the are defined in and other programs . A MACRO is more or less an abbreviation for some lines of code that are used more than once or twice. A FORM is a local subroutine (which can be called external). A FUNCTION is (more or less) a subroutine that is called external. Since debugging a MACRO is not really possible, prevent the use of them (I’ve never used them, but seen them in action). If the subroutine is used only local (called internal) use a FORM. If the subroutine is called external (used by more than one program) use a FUNCTION.

Updated No : 2
ABAP Technical Interview Questions:


1. What is the typical structure of an ABAP program?
2. What are field symbols and field groups.? Have you used "component idx of structure" clause with field groups?
3. What should be the approach for writing a BDC program?
4. What is a batch input session?
5. What is the alternative to batch input session?
6. A situation: An ABAP program creates a batch input session. We need to submit the program and the batch session in background. How to do it?
7. What is the difference between a pool table and a transparent table and how they are stored at the database level?
8. What are the problems in processing batch input sessions? How is batch input process different from processing on line?
9. What do you define in the domain and data element?
10. What are the different types of data dictionary objects?
11. How many types of tables exist and what are they in data dictionary?
12. What is the step-by-step process to create a table in data dictionary?
13. Can a transparent table exist in data dictionary but not in the database physically?
14. What are the domains and data elements?
15. Can you create a table with fields not referring to data elements?
16. What is the advantage of structures? How do you use them in the ABAP programs?
17. What does an extract statement do in the ABAP program?
18. What is a collect statement? How is it different from append?
19. What is open sql vs native sql?
20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
21. What is the meaning of ABAP editor integrated with ABAP data dictionary?
22. What are the events in ABAP language?
23. What is an interactive report? What is the obvious diff of such report compared with classical type reports?
24. What is a drill down report?
25. How do you write a function module in SAP? Describe.
26. What are the exceptions in function module?
27. What is a function group?
28. How are the date abd time field values stored in SAP?
29. What are the fields in a BDC_Tab Table?
30. Name a few data dictionary objects?
31. What happens when a table is activated in DD?
32. What is a check table and what is a value table?
33. What are match codes? Describe?
34. What transactions do you use for data analysis?
35. What is table maintenance generator?
36. What are ranges? What are number ranges?
37. What are select options and what is the diff from parameters?
38. How do you validate the selection criteria of a report? And how do you display initial values in a selection screen?
39. What are selection texts?
40. What is CTS and what do you know about it?
41. When a program is created and need to be transported to prodn does selection texts always go with it? if not how do you make sure? Can you change the CTS entries? How do you do it?
42. What is the client concept in SAP? What is the meaning of client independent?
43. Are programs client dependent?
44. Name a few system global variables you can use in ABAP programs?
45. What are internal tables? How do you get the number of lines in an internal table? How to use a specific number occurs statement?
46. How do you take care of performance issues in your ABAP programs?
47. What are datasets?
48. How to find the return code of a stmt in ABAP programs?
49. What are interface/conversion programs in SAP?
50. Have you used SAP supplied programs to load master data?


Update No 3:
 

1. What are the techniques involved in using SAP supplied programs? Do you prefer to write your own programs to load master data? Why?
2. What are logical databases? What are the advantages/disadvantages of logical databases?
3. What specific statements do you using when writing a drill down report?
4. What are different tools to report data in SAP? What all have you used?
5. What are the advantages and disadvantages of ABAP query tool?
6. What are the functional areas? User groups? How does ABAP query work in relation to these?
7. Is a logical database a requirement/must to write an ABAP query?
8. What is the structure of a BDC sessions.
9. What are Change header/detail tables? Have you used them?
10. What do you do when the system crashes in the middle of a BDC batch session?
11. What do you do with errors in BDC batch sessions?
12. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?
13. Is it possible to run host command from SAP environment? How do you run?
14. What kind of financial periods exist in SAP? What is the relevant table for that?
15. Does SAP handle multiple currencies? Multiple languages?
16. What is a currency factoring technique?
17. How do you document ABAP programs? Do you use program documentation menu option?
18. What is SAPscript and layout set?
19. What are the ABAP commands that link to a layout set?
20. What is output determination?


*********************************************************************************

         If you like this click on Recommend this on google + for knowledge sharing