Skip to Content
avatar image
Former Member

Data type and Data object

Hi Friends,

What is the difference between Data type and Data object?

Best Regards,

VRV Singh

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 21, 2007 at 02:41 PM


    one difference is.

    memory allocation is not done for datatypes

    its done for data objects...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 02:42 PM

    Please look this link it will help u .




    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2007 at 02:45 PM



    Each ABAP program define its own data types using the statement.

    TYPES dtype TYPE type ...

    and declare its own variables or instance attributes of classes using the statement

    DATA var {TYPE type} ...

    Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.

    When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.

    The Additions TYPE and LIKE

    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.

    · Definition of local types in a program

    · Declaration of data objects

    · Dynamic creation of data objects

    · Specification of the type of formal parameters in subroutines

    · Specification of the type of formal parameters in methods

    · Specification of the type of field symbols

    Constructing New Data Types

    The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.

    To construct new data types, the addition TYPE can be used with the following type constructors:

    · Construction of reference types

    REF TO type|dobj

    · Construction of structured data types

    BEGIN OF struc_type.


    END OF struc_type.

    · Construction of table types

    tabkind OF linetype

    These data types only exist during the runtime of the ABAP program.

    Referring to Known Data Types or Data Objects

    Using the additions TYPE or LIKE in the TYPESstatement, local data types in a program can be referred to known data types or data objects. This is mainly the case with user-defined elementary data types. If you declare variables using the additions TYPE type or LIKE dobj with statement DATA, the data type of var is already fully defined before the declaration is made.

    The known types or data that are referred to must be visible at the point where the data type or variable is declared.

    A known data type can be any of the following:

    · A predefined ABAP type to which you refer using the TYPE addition

    · An existing local data type in the program to which you refer using the TYPE addition

    · The data type of a local data object in the program to which you refer using the LIKE addition

    · A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.

    The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context. The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.

    · In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.

    · You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:

    DATA dref TYPE REF TO cl_global.

    DATA: f1 LIKE cl_global=>attr,

    f2 LIKE dref->attr.

    You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.



    Add comment
    10|10000 characters needed characters exceeded