Skip to Content
Former Member
Sep 09, 2010 at 10:46 AM

Regarding Data Reference and Field Symbol



If we compare field symbol and data refernece with that of the pointer in C i conclud that :-

In C language, Say we declare a variable "var" type "Integer" with default value "5".

The variable "var" will be stored some where in the memory and say the memory address which holds this variable is "1000".

Now we define a pointer "ptr" and this pointer is assigned to our variable.

So, "&ptr" will be "1000" and " *ptr " will be 5.

Lets comapre the above situation in SAP ABAP.

Here we declare a Field symbol "FS" and assign that to the variable "var".

Now my question is what "FS" holds ? I have searched this rigorously in the internet but found out many ABAP consultants have the opinion that FS holds the address of the variable i.e. 1000. But that is wrong. While debugging i found out that fs holds only 5.

So fs (in ABAP) is equivalent to *ptr (in C). Please correct me if my understanding is wrong.

Now lets declare a data reference "dref" and another filed symbol "fsym" and after creating the data reference we assign the same to field symbol <fsym>. Now we can do operations on this field symbol. So the difference between data refernec and field symbol is :-

in case of field symbol first we will declare a variable and assign it to a field symbol.

in case of data reference first we craete a data reference and then assign that to field symbol.

Then what is the use of data reference. The same functionality we can achive through field symbol also.