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

regarding ref to

Former Member
0 Likes
612

data : r type reference.

data : r type REF TO reference.

what is difference between those two..

anyone can help me....

thanks in advance ...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hi

data : r type reference.

this is used to define/declare a variable with reference to a already existing data element or data type . we use this in normal ABAP programing

data : r type REF TO reference.

This is used in OOPS ABAP programming.

To reference a class we use this

see the example

first create the class zcl_test in SE24 and then declare in program as

DATA: obj_cust TYPE REF TO zcl_test.

<b>Reward points for useful Answers</b>

Regards

Anji

4 REPLIES 4
Read only

Former Member
0 Likes
593

Hi,

TYPE REF TO is referring to a class name and only TYPE is defining data type.

You can create an object for a class by defining object using type ref to.

Reward if useful!

Read only

Former Member
0 Likes
593

hi

data: r type referrence

<b>it declares data r of type reference.

example: itab type mara.</b>

"it declares internmal table otab of type mara

data : r type REF TO reference.

<b>it declares an object r of a class <b>reference</b></b>

eg

data ; obj type ref to cx_root.

it creates an object obj of a class cx_root

hope it clears ur doubt..

regards

ravish

<b>plz dont forget to reward points if useful</b>

Read only

former_member194669
Active Contributor
Read only

Former Member
0 Likes
594

Hi

data : r type reference.

this is used to define/declare a variable with reference to a already existing data element or data type . we use this in normal ABAP programing

data : r type REF TO reference.

This is used in OOPS ABAP programming.

To reference a class we use this

see the example

first create the class zcl_test in SE24 and then declare in program as

DATA: obj_cust TYPE REF TO zcl_test.

<b>Reward points for useful Answers</b>

Regards

Anji