Register Login

Difference between Field Symbol and Data Reference Variable

Updated May 19, 2018

Hello Everyone,

Please explain me the following programme and what is the difference between field symbol and data reference veriable?

types : begin of line,
col1 type i,
col2 type i,
end of line.

data : dref1 type ref to data,
dref2 type ref to data.

field-symbols : <fs1> type line,
<fs2> type i.
create data dref1 type line.
assign dref1->* to <fs1>.
<fs1>-col1 = 11.
<fs1>-col2 = 22.
dref2 = dref1.
assign dref2->* to <fs2> casting.
write <fs2>.
get reference of <fs1>-col2 into dref2.
assign dref2->* to <fs2>.
write <fs2>.


  • 02 Mar 2015 11:47 am Sushma Helpful Answer

    Well fields symbols hold the address of static data.

    But data reference holds reference of dynamic data. In essence if you want to have a table that can have different structure depending upon your requirement in run time.

    Then you use data reference. They are to be used with field symbols as since you don't know what is there structure till runtime.