Application Development and Automation 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: 
Read only

diff between DATA & Types St.

Former Member
0 Likes
947

hi all,

what is difference between data & types st.?

1 ACCEPTED SOLUTION
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
905

Hi,

You can create strutres using types statement and then make the data declarations to refer them.

For eg.

types : begin of ty,

matnr type mara-matnr,

end of ty.

data itab type standard table of ty.

Here ty is the structure and itab is the internal table refering the structure.

8 REPLIES 8
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
906

Hi,

You can create strutres using types statement and then make the data declarations to refer them.

For eg.

types : begin of ty,

matnr type mara-matnr,

end of ty.

data itab type standard table of ty.

Here ty is the structure and itab is the internal table refering the structure.

Read only

Former Member
0 Likes
905

Hi Sanjeev,

TYPES statement define the structure of your memory space without allocation of memory, DATA statements allocate the memory at runtime.

Regards,

Chetan.

PS:Reward points if this is helpful.

Read only

Former Member
Read only

anversha_s
Active Contributor
0 Likes
905

hi,

in simple words.

using type we are creating structre.

it will not hold any memory area.

but when we use data-> it can refer only a datafield that hold a memory area.

rgds

Anver

Read only

Former Member
0 Likes
905

hi,

i am putting it in simple words

TYPES:

The types statement creates a new type

eg:

TYPE type1

The new type is defined by its type type1.

type1 may be one of the predefined types (C, N, F, etc) or

a type that you have defined yourself using TYPES,

or a type defined in the ABAPDictionary.

DATA:

if u want to create variables which will store values in your program, u use the data statement

eg:

DATA data1.

Creates an internal field data1 in the program with default length

you can declare a variable of a specific type

DATA d1 type i

Field d1 is created with type I, and can then be used in the program. In particular, you can assign numeric values to the field and use it to perform calculations

Hope this will be helpful

and u can mark points if u want to

Regds,

Vs

Read only

former_member404244
Active Contributor
0 Likes
905

Hi,

1>TYPES statement defines the structure without allocation of memory, DATA statements allocate the memory at runtime.

2>create a structure by using types statement and refer it by using the DATA statement.

3>In order to avoid the internal table declaration without header line ,we are declaring a structure by types statemnet and declaring an internal table with reference to the structure.

regards,

Nagaraj

Read only

graghavendra_sharma
Contributor
0 Likes
905

Hi

TYPES just gives you the prototype and will not assign any memory for the datas. But where as DATA will assign memory for the variables. Using TYPES you can create user defined data types.

Here is the example

TYPES: t1(10) TYPE c.

DATA: s1 TYPE t1.

s1 = 'asdfjkl'.

WRITE: s1.

Here "t1" is just an user defined data type of string length 10 and does not occupy any memory since it is a prototype

but s1 is occupies 10 bytes of memory.

Read only

Former Member
0 Likes
905

thanks for reply