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

difference between data and types

naimkhans_babi
Active Participant
0 Likes
703

dear friends

Its a very simple question i am confused with why we create structures with types where we can create structures with data as well :

Types: begin of stru

....

end of stru.

Data: begin of stru

...

end of stru...

regards

Naim

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
637

Hi naim,

1. For practical purpose, we can directly create using data, and no need of using types.

2. Types is generally used for oo programming.

regards,

amit m.

4 REPLIES 4
Read only

Former Member
0 Likes
637

for example ur requirement is create 10 tables with same structure then it is wise to create one type and refer to it n also if in future u want to change some thing with str u change the type and then every thing will change.

santhosh

Read only

Former Member
0 Likes
638

Hi naim,

1. For practical purpose, we can directly create using data, and no need of using types.

2. Types is generally used for oo programming.

regards,

amit m.

Read only

Former Member
0 Likes
637

To construct a new structured data type struc_typein a program, you use several TYPES statements:

TYPES BEGIN OF struc_type.

...

{TYPES dtype ...} | {INCLUDE {TYPE|STRUCTURE} ...}.

...

TYPES END OF struc_type.

The syntax for directly declaring a variable as a structure is the same as you would use to define a structured data type using the TYPES statement:

DATA BEGIN OF struc.

...

{DATA comp ...} | {INCLUDE {TYPE|STRUCTURE} ...}.

..

DATA END OF struc.

The individual components of a structure are addressed in the program with the structure component selector between the structure name and component name as follows: struc_comp.

Have a look at below link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3364358411d1829f0000e829fbfe/content.htm

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers