Category: ABAP Differences

  • Difference between SELECT-OPTIONS and PARAMETERS

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

    Before discussing the differences between SELECT-OPTIONS and PARAMETERS, let’s have a quick introduction of the two.

    Introduction

    SELECT-OPTIONS and PARAMETERS are components of the selection screen. SELECT-OPTIONS are assigned a selection table in the ABAP program as well as two input fields along with a push button for multiple selection.  Parameters are assigned a global elementary data object in the ABAP program as well as an input field. The name of the SELECT-OPTIONS and PARAMETERS is limited to a maximum of 8 characters whereas the length of the input field is restricted to a maximum of 255 characters.

    SELECT-OPTIONS and PARAMETERS statements are allowed in the global declaration part of executable programs, function groups, and module pools. In function groups and module pools, these statements are only allowed within the definition of a standalone selection screen. In executable programs, these statements are automatically assigned to the standard selection screen.

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

    Difference between SELECT-OPTIONS and PARAMETERS in SAP ABAP

    SELECT-OPTIONS PARAMETERS
    It stores value in an Internal table with a predefined structure. It stores value in a variable.
    It can accept multiple single values, multiple ranges, exclusion of values and ranges. It accepts only a single value.
    It creates a Selection table having 4 columns SIGN, OPTION, LOW and HIGH. It does not create a selection table
    If left blank, then all the data is selected from the database. If left blank, then no data is selected from the database.
    For value checking, IN operator is used in WHERE condition. For value checking, operators like =, >, <, <> are used in WHERE condition.
    Value check cannot be forced through Foreign key or domain values. Value check can be forced through Foreign key or domain values.
    Radio buttons or checkbox cannot be created using it. Radio buttons and checkbox can be created using it.

     

  • Difference Between Abstract Class and Interface

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

    Before jumping to the Difference between Abstract Class and Interface, let us have a short introduction of the two.

    Introduction

    Classes, their instances/objects, and access to objects using reference variables forms the basics of ABAP Objects.  A class represents a set of properties or methods that are common to all the objects of one type. However, it is necessary for similar classes to have similar functions that behave differently in each class and having a uniform point of contact.

    ABAP objects make it possible by using Interface and abstract class.

    Like Classes, interface acts as a data type for the objects. The components of interface are the same as of classes. Interface is used when similar classes have same method with the same name but different functionalities. Interface along with inheritance provides a base for polymorphism because methods of the interface can behave differently in different classes.

    Abstract class is a class that contains one or more abstract methods i.e. methods without implementation. This class cannot be instantiated, as the abstract methods have to be implemented in a subclass of the inheritance tree. It can inherit only one class and multiple interfaces. You can explore more about Abstract class in SAP ABAP here.

    Now, let us have a look at their difference.

    Difference between Abstract Class and Interface

    Interface Abstract Class
    It is not a class. It is an independent structure that is used in a class to extend the functionality of a class. It is a special class which can’t be instantiated.
    It is an entity that doesn’t have an implementation. It can contain methods with implementation as well as without implementation.
    No common behaviour is implemented via Interface. For non-abstract methods, common behaviour can be implemented.
    It can inherit multiple interfaces but cannot inherit a class. It can inherit a class and multiple interfaces.
    Multiple inheritance can be achieved. There is only one abstract class as Super Class.
    For new methods, all the implementing classes must implement the new methods. For new non-abstract methods, there is no need to redefine the method.
    All components are PUBLIC by default. The visibility of each component can be set.