‎2006 Apr 20 11:53 AM
Hi,
wats the difference b/n types declaration and data declaration?and wats the difference b/n like and type?
‎2006 Apr 20 12:02 PM
Hi -
1.<b>Data statment</b> is used to define variables refeering to already existing data types ..that may be standard data types (c, n, d, t, i,f etc) or user defined types (eg. referring to any data object or complex types) while <b>types statement</b> is used to define user defined data types based on standard data type or may be existing (previously defined types)types.
2. types doesnt <b>occupy memory</b> and <b>can not hold values</b> whils variable defined using data stmt <b>occupies memory</b> as well as <b>can have values</b>.
same is the case with type and like addition.
like addition expect an ddic object referance while type addition may refer to user defined types.
Thanks
‎2006 Apr 20 12:02 PM
Hi -
1.<b>Data statment</b> is used to define variables refeering to already existing data types ..that may be standard data types (c, n, d, t, i,f etc) or user defined types (eg. referring to any data object or complex types) while <b>types statement</b> is used to define user defined data types based on standard data type or may be existing (previously defined types)types.
2. types doesnt <b>occupy memory</b> and <b>can not hold values</b> whils variable defined using data stmt <b>occupies memory</b> as well as <b>can have values</b>.
same is the case with type and like addition.
like addition expect an ddic object referance while type addition may refer to user defined types.
Thanks
‎2006 Apr 20 12:03 PM
hi,
Type : - It is used for the declaration of structure how ur going to store data ; and what type of data. it doesnt use memmory for storage.
data : it actual place where u store data . data is used to define variable of perticular type.
C , N , D , T ,I,P are ABAP define types
U can used this Type to define ur Custom Type
eg;- Types : CHAR58(58) type c.
Then u can use this custom type for ur variable declartion of length 58 char
that is
DATA my_var type char58.
Many such combination is possible.
U can even declare complex structure
eg
TYPES : begin of ty_t1,
a1 type c,
a2 type char58,
.........
end of ty_t1.
Now ur data part
DATA : my_structure type ty_t1.
Mark helful answers
Regards
Manoj B Gupta
Message was edited by: Manoj Gupta
‎2006 Apr 20 12:09 PM
Type tells you 'How' will be the structure of any variable which refers it.
Data statement creates a variable(Allocates memory to it) by referring to an already existing type.
Like: If you use v_matnr like mara-matnr , the system will refer the mara table and see the matnr field. It then determines what is the data element used for it.Then it allocates the memory for the variable v_matnr.
If you use v_matnr type matnr, then it directly creates the v_matnr variable having similar attributes as the matnr data element.
Regards,
Ravi
‎2006 Apr 20 12:15 PM
hi,
1.when you declare something using TYPES declaration..
you mean to create a type with which you are going to define further elements..
for eg.
types : a type p decimals 2.
data : b type a.again..
when you declare using data you are declaring 'b' for manipulation in the program..
2. when you define using LIKE you copy the attributes of the element completely..
data: a type p decimals 2.
data : b like a.a is an existing variable and b is like a.
regards
satesh