Category: ABAP Differences

  • Difference between Check Table and Value Table

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before discussing the difference between Check Table and Value Table, let’s have a short introduction of the two.

    Table validation is a concept through which the field is restricted to have certain values.

    Field level validation and domain level validation are two concepts of table validation. Field level validations are done to validate entries at field level with the help of a check table whereas domain level validations are done to restrict the values of the field at domain level with the help of fixed values of the domain and value table of the domain.

    Check Table

    Check Table is a table that contains all the valid entries for a field. Fields of a database table whose data type is determined by data element can be assigned the check table. The field of the table to which the check table is assigned is considered as a foreign key field and is part of the foreign key of the table. The table becomes a foreign key table and the primary key of the check table is the foreign key of the foreign key table.  The entries of the primary key of the check table are used as an input help (F4 help) for the foreign key field.

    Value Table

    Value Table is a table that contains all the valid entries of a domain and this domain can be reused in multiple tables. This is maintained at domain level and whenever a foreign key relationship has to be created, the system looks for the value table field, if found, it automatically proposes that name as a check table to generate a foreign key proposal.

    This is a kind of master check and is maintained as a customization object i.e. to enter values to this table a development transport request has to be created and transported.

    Now, let’s have a look at their difference.

    Difference between Check Table and Value Table

    Check Table Value Table
    It is a table which contains all valid entries of a field. It is a table which contains all valid entries of a domain.
    It is a type of field level validation. It is a type of domain level validation.
    It uses foreign key relationship. It is used as a proposal for check table whenever a foreign key relationship is created.

  • Difference between a Static Breakpoint and Dynamic Breakpoint

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before jumping to the difference between a Static Breakpoint and Dynamic Breakpoint, let’s have a short introduction of the two.

    What is a Breakpoint in SAP ABAP?

    A Breakpoint is a signal in a specific line of the ABAP program that interrupts the normal execution of the program and the control is transferred to the Debugger. A breakpoint can be active or passive at runtime and can be set for the specific users, all users or based on checkpoints. Breakpoints help in debugging and analysing ABAP Objects, ABAP programs and evaluating only the concerned sections of ABAP code, while skipping the rest of the areas.

    Static Breakpoint

    Static Breakpoints are recommended for use only during the development of an application where the program execution needs to be interrupted at the same point for analysis. These must be deleted once the development phase is over. These are set by an ABAP statement and can be of the following types:

    • User non-specific: These are inserted by the ABAP keyword BREAK-POINT. These are applied to all users and the system interrupts the execution for all the users.
    • User-specific: These are inserted by the ABAP keyword BREAK <USERNAME>. These are applied to the specified user and the system interrupts the execution for the specified user.

    Dynamic Breakpoint

    Dynamic Breakpoints are triggered when the program that you are running reaches a particular ABAP statement or exception class. These are user-specific and gets automatically deleted when the user logs off. A total 30 dynamic breakpoints can be set without changing source code.

    Dynamic Breakpoints are more flexible than Static Breakpoints as the former can be created, deactivated or deleted at runtime. Dynamic breakpoints can be set even when the program is locked by another user.

    Now, let’s have a look at their difference.

    Difference between a Static Breakpoint and Dynamic Breakpoint

    Static Breakpoint Dynamic Breakpoint
    They can be set using statement “BREAK-POINT” and “BREAK <USERNAME>” in ABAP code. They can be set in ABAP editor and in debugging mode.
    These are not normally user specific; but can be set for specific users. These are user specific.
    These cannot be set when the program is locked by another user These can be set even if the program is locked by another user.
    These needs to be deleted manually. These are deleted automatically when you log-off from SAP.

  • Difference between Procedural Programming and Object-oriented Programming

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before jumping to the difference between a Procedural Programming and Object-oriented Programming, let’s have a short introduction of the two.

    Programs are the instructions that tell the computer what to do to come up with the solution to a particular problem. There are several approaches to building solutions to specific types of problems with programming. Two of the most important approaches are procedural programming and Object-Oriented Programming.

     

    Procedural Programming

    Procedural Programming is a structured programming approach, based upon the concept of calling procedures which consists of a series of computational steps to be carried out. It follows Top Down approach to solve any problem. There is no accessing mode required to access the attributes or functions of a particular program. There is no proper way of hiding data, hence it is less secure.

    Object-oriented Programming

    Object-Oriented Programming is based upon the concept of Objects and Classes. It follows Bottom Up approach to solve the problem. The OOP paradigm focuses on the data rather than the algorithm to create the modules by dividing into the data and functions. An object contains the data in the form of attributes and codes in the form of methods. It provides data abstraction; hence it is more secure than procedural programming.

    Procedural Programming and Object-oriented Programming

    Procedural programming is simple and straight forward as it allows good isolation and containment for variables when properly scoped with functions and control loops. But it becomes more prohibitive to maintain the larger codes.  Here comes the Object-oriented Programming which makes it easy to maintain the codes as new objects can be created which control their data. SAP provides us option to implement of them altogether.

    Difference between Procedural Programming and Object-oriented Programming

    Now, let’s have a look at their difference.

    Procedural OOPs
    It is process-oriented. It is result-oriented.
    Follows Top down approach. Follows Bottom up approach.
    Each function contains different data. Each object controls its data.
    There is no access specifier They have access specifiers such as Private, Public, Protected etc.
    Adding new data and function is not easy. Adding new data and functions is easy.
    Overloading is not possible. Overloading is possible.
    It is less secure. It is more secure.
    No concept of inheritance. Inheritance is allowed.

     

  • Difference between SAP Memory and ABAP Memory

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before jumping to the differences between SAP memory and ABAP Memory, let’s have a short introduction.

    ABAP programs utilize two types of memory: SAP memory and ABAP memory. The main difference between the two memories is their scope.

    SAP Memory and ABAP Memory

    ABAP memory is very limited as it can only accessible within one internal session and programs running outside the session are not able to read or write this memory. Whereas, SAP Memory is a global memory and is accessible to all the programs running under that session as well as across different main sessions. SAP memory can be used to pass data from one program to another either within a session or to another session.

    In terms of usage, the main use of ABAP memory is to make data accessible to multiple programs within the same session. Whereas, SAP memory also makes data available across multiple sessions.

    When dealing with SAP memory, GET/SET parameters are used to exchange data. To set these parameters for a user or a program, SET PARAMETER is used and other programs can then retrieve the parameter using the GET PARAMETER command. On the other hand, ABAP memory can be accessed by the ABAP programs within the same internal session using IMPORT and EXPORT commands. Data within this memory remains intact during a sequence of program calls.

    It is important to they are used appropriately to enhance the speed and efficiency of the application as well as resource usage.

    Difference between SAP Memory and ABAP Memory

    Now, let’s have a look at their difference.

    SAP Memory ABAP Memory
    It is a Global Memory. It is a local Memory.
    All SAP GUI sessions have access to it. All programs within a session can have access.
    It makes data available across main session It makes data available multiple session within same session.
    Data can be exchanged using GET/SET. Data can be exchanged using EXPORT/IMPORT.

     

  • Data Class vs Delivery Class in SAP ABAP: Differences

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    The most common question of an ABAP Interview is the difference between Data Class and Delivery class of an ABAP Table. In our previous articles, we have discussed both in detail and now we will discuss their differences.

    Before jumping to the difference between a Data Class and Delivery class, let’s have a short introduction of the two.

     

    Data Class

    A Data Class represents a physical area in the database where all the data of the table assigned to this Data Class are stored.

    Data Class in ABAP can be assigned to a table using its Technical Settings. SAP was smart while creating properties for tables. With the help of Data Class, SAP divides and organize the Tables according to their type of Data. It keeps all Master Data together, all Transaction Data together, all User Data together and all Organizational Data together. This increases system performance as well as increases system availability.

    Types of Data Class are:

    • APPL0 (Master Data): Data which is rarely changed.
    • APPL1 (Transactional Data): Data which is changed frequently.
    • APPL2 (Organizational Data): Data defined when the system is installed and seldom
    • USER and USER1 are provided for the customer.

     

    As Data Class determines the type of data the table contains, the Delivery class determines the behaviour of the table.

     

    Delivery Class

    A delivery class defines:

    • Transport control of Data within Landscapes and customer systems
    • Transport control of Data for an installation and upgrade
    • Transport control of Data of client copy
    • If data can be maintained in Extended Table Maintenance [SM30] using TMG or not.

     

    In short, we can say a delivery class determines whether data of the table can be maintained & transported or not.

    Types of Delivery Class are:

    • A: Application table (master and transaction data).
    • C: Customer table, data maintained by the customer only.
    • L: Table for storing temporary data

     

    Difference between Data Class and Delivery class

    Now, let’s have a look at their difference.

    Data Class Delivery Class
    It determines the actual physical area of database where table is created It controls the degree to which SAP or customer is responsible for table maintenance
    It is set in Technical settings for the table It is set in Delivery & Maintenance
    It determines the type of data the table contains. It determines the table type.
    They are of 5 types:

    APPL0 à Master Data

    APPL1 à Transactional Data

    APPL2 à Organizational Data

    USER, USER1

    Following are the delivery classes:

    Aà Application table

    Cà Customer table

    L,G,E,S,W

     

     

  • Difference between Domain and Data Element

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before jumping to the difference between a Domain and Data Element, let’s have a short introduction of the two. We need to use data in ABAP reports and it needs to be define in ABAP Dictionary and for that we need to define Domain, Data Element and, Tables.

     

    Domain

    A domain is a reusable object which describes the technical characteristics of an attribute. It defines a value range, which sets the permissible data values for the fields, data types, conversion routine, etc. A single domain can be used for any number of fields of identical structure.

    With the help of domain, lowercase letters can be entered into the table fields.

     

    Data Element

    A domain cannot be directly used in a Report/Program or as a table field, it is assigned to a data element that adds some semantic information to the field i.e. Field Label, heading, etc.

    Data Element is the smallest individual component of the complex types and is used to provide field labels, documentation, parameter ID, and search help for the table field.

     

    At Domain level, Search Help fetches data either from defined fixed value or Value Table while Search help assigned to Data Element fetches data from Global Search help created via SE11.

     

    Difference between Domain and Data Element

    Now, let’s have a look at their difference:

    Domain Data Element
    It is used to describe the technical characteristics of an attribute. It is used to describe the semantic definition of the table field.
    It describes the value range, data types, and conversion routine. It provides field labels, documentation, parameter ID, and search help for the table field.
    Search help assigned to it fetches data from either fixed value or Value Help Table. Search help assigned to it fetches data from Global Search help created via SE11.
    It is assigned to a data element. It is assigned to a table field or structure.
    It cannot be referenced in ABAP programs. It can be referenced in ABAP programs with TYPE.
    It is stored in Standard Table DD01L and Domain texts are stored in DD01T. It is stored in standard Table DD04L and Data Element texts are stored in DD04T.

     

  • Difference between Static Attribute and Instance Attribute

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before discussing the differences between a Static attribute and Instance attribute, let’ have a quick introduction.

    ABAP Class Attribute

    Attributes are data objects of any data type within a class. The state of the class is defined by the content of the attribute. They are defined in the declaration section of the class.

    Static Attribute

    Static attributes and instance attributes are two common types of attributes in the class.

    Static attribute defines the state of the class and this state is common to all the instances of the class. Static attributes can be accessed before any instance of the class is created. For a static attribute, memory for it is allocated only once irrespective of the class instance.  All the instances of the class share the same static attribute. Whenever there is a change in the value of this attribute, it is visible to all the instances of the class.

    Syntax to declare a static attribute:

                    CLASS-DATA static_attribute TYPE data_type.

    Instance Attribute

    Instance attribute defines the instance-specific state of the object. An instance attribute can only be accessed using a reference variable. Memory for an instance attribute is allocated for each instance of the class i.e. if a class have 3 instance attributes and 2 instances of the class then 6 memory locations are allocated for this attribute. Whenever there is a change in the content of the attribute, this change is only visible to that instance which has changed it.

    Syntax to declare an Instance attribute:

    DATA instance_attribute TYPE data_type.

    Difference between Static Attribute and Instance Attribute

    Now, let’s have a look at their difference.

    Static Attribute Instance Attribute
    It can be called irrespective of the class instance. It can be only called using object reference.
    It is declared using CLASS-DATA keyword. It is declared using DATA keyword.
    Memory is allocated only once. Memory is allocated for each instance.
    Every instance shares the same static attribute. Each instance has its own copy of the instance attribute.
    Change to static attribute are reflected to all the instances of the class. Change to an instance attribute is restricted to that particular instance.
    It cannot be redefined in subclasses. It can be redefined in subclasses.

     

  • Difference between Local Classes and Global Class

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before discussing the difference between Local classes and Global class, let’s have a short introduction of the two.

    Class

    Classes are a blueprint for objects and represent a set of properties or methods common to all objects of the same type. Classes in SAP ABAP can be defined either locally or globally.

    Local classes

    Local classes hide in a report source whereas Global classes sit themselves out centrally in the class pool within the class library of the R/3 Repository. If you are creating a report to do some specific task without worrying about the outside world, you can create a local class. But if you’re working on a class that may be of interest to other reports, consider creating a global class.

    Let see an example of local class implementation below:

    *---------------------------------------------------------------------*
    *       CLASS MAIN DEFINITION
    *---------------------------------------------------------------------*
    CLASS main DEFINITION.
      PUBLIC SECTION.
    
        "// Instance Methods ( Note: we use the statement 'METHODS'
        "// to define an instance method )
        METHODS set_data IMPORTING i_data TYPE string.
    
        "// Instance Methods ( Note: we use the statement 'CLASS-METHODS'
        "// to define a static method )
        CLASS-METHODS set_classdata IMPORTING i_data TYPE string.
    
      PROTECTED SECTION.
    
        "// Instance Attribute ( Note we use the statement 'DATA'
        "// to define an instance attribute )
        DATA attribute TYPE string.
        "// Static Attribute ( Note we use the statement 'CLASS-DATA'
        "// to define a static attribute )
        CLASS-DATA classattribute TYPE string.
    
      PRIVATE SECTION.
    
        "// Instace event ( Note we use the statement 'EVENTS'
        "// to define aN instance event )
        EVENTS event EXPORTING value(e_data) TYPE string.
    
        "// Instace event ( Note we use the statement 'CLASS-EVENTS'
        "// to define a static event )
        CLASS-EVENTS classevent EXPORTING value(e_data) TYPE string.
    
        "// For more informations about events see the following example:
        "// ABAP Objects - Creating your First Local Class - Using Events
    
    ENDCLASS.                    "main DEFINITION
    Class Implementation
    
    Error rendering macro 'code': Invalid value specified for parameter 'lang'
    *---------------------------------------------------------------------*
    *       CLASS main IMPLEMENTATION
    *---------------------------------------------------------------------*
    CLASS main IMPLEMENTATION.
      METHOD set_data.
        CONCATENATE 'Instance Attribute value' i_data
                                   INTO attribute SEPARATED BY space.
      ENDMETHOD.                    "set_data
      METHOD get_data.
        MOVE attribute TO r_data.
      ENDMETHOD.                    "get_data
      METHOD set_classdata.
        CONCATENATE 'Static Attribute value' i_data
                                   INTO classattribute SEPARATED BY space.
      ENDMETHOD.                    "set_classdata
      METHOD get_classdata.
        MOVE main=>classattribute TO r_data.
      ENDMETHOD.                    "get_classdata
      METHOD print_attribute.
        WRITE: lv_data, /.
      ENDMETHOD.                    "print_attribute
      METHOD print_classattribute.
        WRITE: lv_data, /.
      ENDMETHOD.                    "print_classattribute
    ENDCLASS.                    "main IMPLEMENTATION

     

    When a class is used in an ABAP program, the system first searches for the local class with the specified name, if not found, it looks for a global class.

    As the Local class is visible to a particular program, visibility of all the component can be set to PUBLIC. A Local class can be defined in a global class. It is defined in the Local Types section and implemented in the Implementation section of the Class Editor.

    Global Class

    The Global class is visible to all the programs, visibility to all components are explicitly assigned. The components with PRIVATE visibility are only accessible in the class itself and are not visible to the subclass.

    SAP ABAP Global Class Builder

    Now, let’s have a look at their difference.

    Difference between Local Classes and Global Class

    Local Class Global Class
    It is defined within a program. It is defined in Class Builder (T-Code SE24).
    It can be only used in programs in which it is defined. It is stored in class pools and can be used by any ABAP programs.
    It can be designed “more open” as it is only accessible to within the context. It can be designed “less open” as it is accessible to all the ABAP programs.
    It can be defined in a global class. It cannot be defined in a local class.

     

  • Difference between Class and Function Module

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before jumping to the difference between Class and Function Module, let’s have a short introduction.

    An ABAP program consists of program blocks and is executed sequentially. This is a classical approach for programming known as procedural programming model. This model uses functions and subroutines.

    Object Oriented programming paradigm is based on class and object and aims to implement real-world entities such as inheritance, abstraction, etc.

    Function Module

    Function modules are procedures that have a set of re-usable statements with importing, exporting parameters, etc. These are created in ABAP workbench using the Function Module Builder. They are managed in the central function library. They play an important role in updating and in the interaction between different SAP systems, between SAP systems and remote systems through remote calls. Unlike Include, they can execute independently. Every function module needs to be assigned to a function pool called the function group. A Function group is a container that holds function modules that should be together logically. Function modules also support exception handling to catch any errors while they are running.

    Class

    Classes are a blueprint for objects and represent a set of properties or methods common to all objects of the same type. The components of a class are called data members. The class provides the flexibility to assign visibility to all its data members. Every instance or objects have unique identity and has its own set of values for the attributes. A class can inherit another class and interfaces. You can read more about classes here.

    Now, let’s have a look at their difference.

    Difference between Class and Function Module

    Function Module Class
    It is procedural oriented. It is object oriented.
    It is created using Function Module Builder (T-code se37). It is created using Class Builder (T-Code SE24).
    It is always public. A class can be Public, Private or Protected.
    Variables are always Private. Variables can be Public, Private or Protected.
    Cannot create any instances. Can create multiple instances.
    Inheritance is not possible. Inheritance is possible.
    Screens can be created using it. To create a screen, the class must call another program.

     

  • Difference between Static Method and Instance Method

    Preface – This post is part of the Differences in ABAP for Interviews series.

    Introduction

    Before discussing the differences between an Instance method and Static method, let’ have a quick introduction.

    A method is a block of codes that defines behaviour of an object of the class.  The method can access all the attributes of the class and can change the object data content.

    Instance Method

    Instance methods are defined using the METHODS statement. They get reinitialized every time an instance is created.  They can access all the attributes of the class and can trigger all its events. Instance methods have the flexibility to be inherited and can be redefined in subclasses.

    Syntax to call an instance method: 

    DATA instance_name TYPE REF TO class_name.
    
    CREATE OBJECT instance_name.
    
    CALL METHOD instance_name->instance_method(…).

     

    Static Method

    Static methods are defined using the CLASS-METHODS statement. They are called only once, when the program is started, irrespective to the class instance, and don’t get reinitialized throughout the execution of the program. They can access only static attributes and can trigger only static events of the class. They can be directly accessed by the class name itself.

    Syntax to call a static method:

    CALL METHOD class_name => static_method(..).

    Now, let’s have a look at their difference.

    Difference between Static Method and Instance Method

    Instance Method Static Method
    It requires instance. It doesn’t require instance.
    It is an example of pass by value. It is an example of pass by reference.
    It is defined using “METHODS”. It is defined using “CLASS-METHODS”.
    Involves declaration of reference variable, instantiating the class and then calling the class. Can be directly accesses by the class name.
    It can access all attributes of a class. It can access only static attribute of a class.
    Can be redefined in sub classes. Cannot be redefined in sub classes.

    Instance method over Static method

    It sounds simpler to use Static methods as it does not involve long steps such as the declaration of a reference variable, instantiating the object and then calling the method. Static methods can be directly accessed by the class name.

    But the question arises is that why instance methods are preferred over Static methods.

    One of the important concepts of OOABAP is Polymorphism i.e. replacing the default implementation of the method with a specific implementation. Polymorphism is achieved by Method Redefinition. Since Static methods are operable on their own and are independent of the instances of the class, they cannot be overridden. Whereas Instance methods can be inherited to sub classes, they can be redefined with the specific implementation.