Internal Tables & Modularization

Internal tables (Standard, Sorted, Hashed) are used for temporary, runtime data storage in SAP ABAP, with performance determined by access type. Modularization (Subroutines, Function Modules, Methods) improves code readability, reduces redundancy, and aids maintenance through reusability, with techniques like Call by Reference improving memory efficiency.

Some Important Basic Questions

  • What are Internal Tables?
    These are temporary memory areas that exist only during program runtime to store and process data retrieved from database tables.

  • List the three types of Internal Tables.
    Standard (linear search), Sorted (automatically sorted by key, binary search), and Hashed (unique keys, fastest access via hashing).

  • What are Modularization techniques?
    Techniques used to break down code into smaller, reusable blocks to improve readability and maintenance; common units include Subroutines, Function Modules, and Methods (OOP).

  • Explain 'Pass by Value' vs. 'Pass by Reference'.
    Pass by Value creates a copy of the variable (changes do not affect the original), while Pass by Reference passes the memory address (changes directly affect the original variable).

SAP ABAP Internal Tables Interview Questions

1. What are the types of Internal Tables and their access times?

2. What is the difference between APPEND and COLLECT?

  • APPEND: Adds a row to the end of a standard table, regardless of content.

  • COLLECT: Adds data, but if a matching key exists, it sums the numeric fields instead of adding a new row.

3. What is a Work Area and when do you use it?
A Work Area is a structure used to process an internal table one row at a time. It is essential when reading, updating, or inserting records into a table.

4. What is the benefit of READ TABLE ... BINARY SEARCH?
It significantly increases search speed on a sorted table or a standard table that has been sorted manually, reducing the search time from linear to logarithmic.

5. How do you free up memory from an internal table?
Use the FREE statement to release the memory occupied by the table, or REFRESH to delete all rows while keeping the table structure.

SAP ABAP Modularization Interview Questions

1. What are the benefits of Modularization?

  • Reusability: Code can be reused multiple times.

  • Maintainability: Easier to update specific logic.

  • Readability: Simplifies complex code.

2. What are the different types of Subroutines?

  • Internal: Subroutine (FORM) exists within the same program.

  • External: Subroutine exists in a different program.

3. What is the difference between CALL BY REFERENCE and CALL BY VALUE?

  • Call by Reference: The subroutine works with the original data. Changes are reflected immediately.

  • Call by Value: The subroutine works with a copy. Changes do not affect the original data unless VALUE(...) is used in FORM definition.

4. What is the difference between a Subroutine and a Function Module?

  • Subroutine: Local to a program, faster, no special interface.

  • Function Module: Stored in the Function Library (SE37), can be RFC-enabled, handles exceptions, and must belong to a Function Group.

5. What is a Function Group?
It acts as a container for Function Modules. A group allows modules to share global data.

6. What are Macros?
Macros are used to define a block of code within a program that is executed multiple times, improving performance but decreasing readability if overused.

7. How do you pass an Internal Table to a Subroutine?
Using TABLES parameter in PERFORM (obsolete) or USING/CHANGING with TYPE STANDARD TABLE.