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

Declaring variables

Former Member
0 Likes
473

Hi,

While declaring variables we make use of TYPES,DATA,LIKE,TYPE.Whats the purpose and difference between types and data and in the same way for like and type.

1 ACCEPTED SOLUTION
Read only

bpawanchand
Active Contributor
0 Likes
442

Hi

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2fb2358411d1829f0000e829fbfe/content.htm

TYPES :

BEGIN OF type_s_tab,

a TYPE i,

b TYPE i,

END OF type_s_tab.

TYPES :

t_c(50) TYPE c.

the above declaration does not have any memory assigned to it

DATA :

itab TYPE

STANDARD TABLE OF type_s_tab.

DATA :

w_c TYPE t_c.

The above declarations are objects of TYPE type_S_tab and t_c

and memory is assigned to it

DATA :

w_char LIKE w_c.

The above declaration of the object is referring to the type of w_c which is occupying 50 characters.

Regards

Pavan

3 REPLIES 3
Read only

former_member206439
Contributor
0 Likes
442

hI

Type: It is used when userdefined object link with SAP

system data type.

Like: It is when data object link with the other data

object.

Read only

bpawanchand
Active Contributor
0 Likes
443

Hi

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2fb2358411d1829f0000e829fbfe/content.htm

TYPES :

BEGIN OF type_s_tab,

a TYPE i,

b TYPE i,

END OF type_s_tab.

TYPES :

t_c(50) TYPE c.

the above declaration does not have any memory assigned to it

DATA :

itab TYPE

STANDARD TABLE OF type_s_tab.

DATA :

w_c TYPE t_c.

The above declarations are objects of TYPE type_S_tab and t_c

and memory is assigned to it

DATA :

w_char LIKE w_c.

The above declaration of the object is referring to the type of w_c which is occupying 50 characters.

Regards

Pavan

Read only

former_member787646
Contributor
0 Likes
442

Hi

Types: It is the statement used to define our own local data types in the program. Types won't occupy

any memory at run time.

Data: It is the statement to declare a local variable in the program. Data objects occupy memory at

runtime.

Hope it helps.

Murthy