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

hi

Former Member
0 Likes
662

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?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
641

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.

6 REPLIES 6
Read only

Former Member
0 Likes
641

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.

Read only

Former Member
0 Likes
641

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.

Read only

Former Member
0 Likes
641

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.

Read only

Former Member
0 Likes
641

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

Read only

Former Member
0 Likes
642

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.

Read only

Former Member
0 Likes
641

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