Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Difference Between Data Type and Data Object

Former Member
0 Kudos

Difference Between Data Type and Data Object

9 REPLIES 9

Former Member
0 Kudos

Hi..,

DATA OBJECT will have memory..

DATA TYPE will not have any memory..

When u create itab with DATA ,, the initial memory will be allocated for the internal table ...( Here the object is created )

But when with TYPES no memory will be created !!!( Here the object is not yet created, it just stores the type of the table..thats it )..

again u need to define a table with DATA statement of this TYPE.

Try this simple code..

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

data w_value type i.

w_value = 2.

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

types w_value type i.

w_value = 2.

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

The first case is correct .. because w_value is a data object which has some memory and can store a value !!

But the second case gives an error !!! because w_value (use defined data type ) doesnot have any memory !!! its type is just created , not the object..

Hope u understood !!

plz do remember to close your thread, when ur problem is solvedd !! reward all helpful answers !!

regards,

sai ramesh

Former Member
0 Kudos

Hi Magesh,

DATA TYPE is a TYPE of the DATA OBJECT.

Means if u have a data field in database table named say...

TEMP type CHAR LENGTH 10.

then TEMP is your DATA OBJECT and CHAR is its DATA TYPE.

DATA OBJECTS are FIELDS, TABLES, STRUCTURES, etc.

DATA TYPES are CHAR, INT , NUMC, DATUM etc.

<b>Reward Points iof answer was helpful,</b>

Regards,

Tejas

Former Member
0 Kudos

HI

DATA TYPE is.....the type of a DATA OBJECT....

for exapmle, if there is a data element named say,

ZELEMENT...of TYPE INTEGER 4.

So here....

DATA TYPE is INTEGER for DATA OBJECT named 'ZELEMENT'.

various DATA TYPES are... CHAR, INT, DATS, NUMC etc...

and DATA OBJECTS are.... Data Element, Table, view, domain, filed etc.

Data consists of strings of bytes in the memory area of the program. A string of related bytes is called a field. Each field has an identity (a name) and a data type. All programming languages have a concept that describes how the contents of a field are interpreted according to the data type.

In the ABAP type concept, fields are called data objects. Each data object is an instance of an abstract data type. Data types in ABAP are not just attributes of fields, but can be defined in their own right. There are separate name spaces for data objects and data types. This means that a name can at the same time be the name of a data object as well as the name of a data type.

Data Types:

As well as occurring as attributes of a data object, data types can also be defined independently. The definition of a user-defined data type is based on a set of predefined elementary data types. You can define data types either locally in the declaration part of a program (using the TYPES statement) or globally in the ABAP Dictionary. You can use your own data types to declare data objects or to check the types of parameters in generic operations.

Data types can be divided into elementary, reference, and complex types

Data objects:

Data objects are the physical units with which ABAP statements work at runtime. Each ABAP data object has a set of technical attributes, which are fully defined at all times when an ABAP program is running. The technical attributes of a data object are its length, number of decimal places, and data type. ABAP statements work with the contents of data objects and interpret them according to their data type. You declare data objects either statically in the declaration part of an ABAP program (the most important statement for this is DATA), or dynamically at runtime (for example, when you call procedures). As well as fields in the memory area of the program, the program also treats literals like data objects.

ABAP contains the following kinds of data objects

Literals

Named Data Objects

Predefined Data Objects

Dynamic Data Objects

Regards Rk

Message was edited by:

Rk Pasupuleti

Former Member
0 Kudos

Hi,

DATA OBJECT will have Some memory when you declare it.

But DATA TYPE will not have any memory, but we can declare a data object of this TYPE declared.

with regards,

Jay

0 Kudos

Hi,

Data Type - Just a structure declaration of Objects where it doenst have memory to hold the Values. Its a Template.

Data Object - Declaration of Data Type, where the Object has memory and can hold values during runtime.

As a part of Structural Programming, both Data Types & Objects is required for Professional way of coding & easy understanding.

Regards,

Anbalagan

Former Member
0 Kudos

Hi,

Data type is used to declare a data object.

ex: name(10) type c. In this name is data object and C is data type.

Thanks&Regards

Giridhar

Former Member
0 Kudos

hi magesh

<u><b>Data types</b></u> can be divided into

elementary,

reference, and

complex types.

<u><b>Elementary Types</b></u>

Elementary types are the smallest indivisible unit of types. They can be grouped as those with fixed length and those with variable length.

<u><b>Fixed-Length Elementary Types</b></u>

There are eight predefined types in ABAP with fixed length:

<u><b>Four character types:</b></u>

Character (C),

Numeric character (N),

Date (D),

and Time (T).

<b>One hexadecimal type:</b>

Byte field (X).

<b>Three numeric types:</b>

Integer (I),

Floating-point number (F)

and Packed number (P).

<u><b>Variable-Length Elementary Types</b></u>

There are two predefined types in ABAP with variable length:

STRING for character strings

XSTRING for byte strings

Reference Types

<b>Reference types</b>

describe data objects that contain references (pointers) to other objects (data objects and objects in ABAP Objects).

<u><b>Data Types</b></u>

1) As well as occurring as attributes of a data object, data types can also be defined independently.

2)You can then use them later on in conjunction with a data object.

3) The definition of a user-defined data type is based on a <b>set of predefined elementary data types.</b>

4) You can define data types <b>either locally in the declaration part of a program</b> using the TYPESstatement) or <b>globally in the ABAP</b> Dictionary.

5) You can use your own data types to declare data objects or to check the types of parameters in generic operations.

<u><b>Data Objects</b></u>

1)<b>Data objects</b> are the physical units with which ABAP statements work at runtime.

2) The contents of a data object occupy memory space in the program.

3) <b>ABAP statements access these contents by addressing the name of the data object</b> and interpret them according to the data type..

4) For example, statements can write the contents of data objects in lists or in the database, they can pass them to and receive them from routines, they can change them by assigning new values, and they can compare them in logical expressions.

5) Each <b>ABAP data object has a set of technical attributes</b>, which are fully defined at all times when an ABAP program is running (field length, number of decimal places, and data type).

6) You <b>declare data objects</b> either <b>statically in the declaration part</b> of an ABAP program (the most important statement for this is DATA), or <b>dynamically at runtime</b> (for example, when you call procedures).

7) As well as fields in the memory area of the program, the program also treats literals like data objects.

hope this helps u,

reward points if useful

Ginni

Former Member
0 Kudos

Hi

Data type is a user defined using keyword TYPES.

for an example

types : bbb type i.(or data dictionary objects)

bbb = 2.

write bbb.

one error occur in this step.that error is

Field "BBB" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.

Data object:

Data object is a predefined using keyword DATA. we directly access the data dictionary objects.

data: bbb1 type bbb.(or data dictionary objects)

bbb1 = 2.

write bbb1.

Data objects we are used directly in our programs while data type: we only declared if we use program through data statement. Data object has own memory but data type hasn't memory.........

Hope this helps...

Regards

Mani R

rohit2054
Discoverer
0 Kudos

A formal variable description is called a data type. A variable or constant that is defined concretely by data type is called a data object.