‎2009 Apr 28 12:35 PM
Hi friends
can any one tell me what exactly is the differnce between the below 2 declrations
a) Types:
Begin of TY_STRUC1,
F1 type I,
F2 type P,
F3(10) type C,
F4(5) type N,
End of TY_STRUC1.
i have declared it using types .
b) data :
Begin of TY_STRUC1,
F1 type I,
F2 type P,
F3(10) type C,
F4(5) type N,
End of TY_STRUC1.
i have declared it using data statement.
can any one tell me technically what exactly is the difference between the above 2 declarations
Regards
Priyanka.
‎2009 Apr 28 12:37 PM
with type you can allocate any data to that.
and next one can act as work area because it is a field string.
cheers
s.janagar
‎2009 Apr 28 12:39 PM
Hello Priyanka,
When you declare something like a type, you can reuse it as a declaration type wherever required in your program, whereas the other data declaration, you can just directly use that as a structure..
Say for example, if you want to declare a structure similar to ty_struc1 in a subroutine, then you can declare there as
data : wa_struc type ty_struc1.
whereas if you have the use the other one, you need to use a 'like' statement.
‎2009 Apr 28 12:40 PM
Priyanka,
Second one can be directly used as Work Area whereas for the first one you need to create work area again by using Data statement as shown below
Data: wa_struc1 type TY_STRUC1.
Check ABAPDOCU transaction for more examples on this.
Thanks,
Babu Kilari
‎2009 Apr 28 12:40 PM
Hello,
When u are declaring using TYPES key word that is user specifed it will not allocate the memory.
If we declare using DATA key word it will take the memory......
‎2009 Apr 28 12:42 PM
Hi Priyanka,
The system does not allocate memory when you declare using types. In the first case, you are just defining a template for an internal table. You can actually hold data, only if you create another internal table using "data" statement.
eg: data: wa_struct1 type ty_struc1.
Now you can use wa_struc1 in the program to hold data.
On the other hand, the second type of declaration, reserves memory area and hence can hold data during progtam execution.
Regards,
Shiny