‎2008 May 19 8:14 AM
1.what s the diff b/w following ?
data: name(20) type c.
types:name(20) type c.
2. can i declare the data types anywhere in the report program? S t compulsary to declare them at the top of the report pgm?
‎2008 May 19 8:22 AM
hi,
Data types
You can define data types either locally in the declaration part of a program using the TYPESstatement) 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 objects are the physical units with which ABAP statements work at runtime. The contents of a data object occupy memory space in the program. ABAP statements access these contents by addressing the name of the data object and interpret them according to the data type..
[data type & data object|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3400358411d1829f0000e829fbfe/content.htm]
go throught this link u will find the difference.
‎2008 May 19 8:18 AM
Hi
2. can i declare the data types anywhere in the report program? S t compulsary to declare them at the top of the report pgm?
u need to declare the data types before u use it.
‎2008 May 19 8:18 AM
Hi,
data: name(20) type c.
the above one is the data object . so you can use that as a variable in your program.
types:name(20) type c.
the above one is the user defined type object .
you can not use that as a variable.
data: v_name type name. --> name is the type of 20 chars.
can i declare the data types anywhere in the report program? S t compulsary to declare them at the top of the report pgm?
yes you can declare any where. Best practice is declare on the top.
‎2008 May 19 8:20 AM
Hi,
data: name(20) type c.
types:name(20) type c.
Using data statement u create a variable.
Using types statement u create a data type.
Now u can use this types:name(20) type c.
data : val type name.
val is variable with length 20 type Character.
types is used for user defined data types.
2. can i declare the data types anywhere in the report program? S t compulsary to declare them at the top of the report pgm?
U can declare variable in anywhere of the program.
if u declere in top of the report that can be used globally.
Regards,
Narasimha.
‎2008 May 19 8:20 AM
hi
when u declare variables by useing DATA
memory get allocated to them and they r data object
and when u use TYPE u only define the defination or an type no memory is allocated to it .
Cheers
snehi chouhan
‎2008 May 19 8:22 AM
hi,
Data types
You can define data types either locally in the declaration part of a program using the TYPESstatement) 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 objects are the physical units with which ABAP statements work at runtime. The contents of a data object occupy memory space in the program. ABAP statements access these contents by addressing the name of the data object and interpret them according to the data type..
[data type & data object|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3400358411d1829f0000e829fbfe/content.htm]
go throught this link u will find the difference.
‎2008 May 19 8:26 AM
Hi Selvakumar
First i like to explain you about LIKE, TYPE keywords.
LIKE is used to refer dataobjects.
TYPES is to refer data types i.e. char,int,numc etc...
And DATA is used to refer global variables.
So the declarations u mention doesn't make any difference here. Just analyse to use them acc. to scenarios.
If it helpful to you,
Reward me.
Thanks
Suren