SAP Tutorials Blog


 


"This snippet shows that three data references are created

"with the same reference variable. Storing them in an internal table

"using the type TYPE TABLE OF REF TO prevents the overwriting.


DATA: dref TYPE REF TO data,

      itab TYPE TABLE OF REF TO data,

      num  TYPE i VALUE 0.


DO 3 TIMES.

  "Adding up 1 to demonstrate a changed data object.

  num += 1.


  "Creating data reference and assigning value.

  "In the course of the loop, the variable gets overwritten.

  dref = NEW i( num ).


  "Adding the reference to itab

  itab = VALUE #( BASE itab ( dref ) ).

ENDDO.


Serkan AKKAVAK

Computer Engineer BSc

Head of SAP & Software Department

Contact : serkurumsal@yandex.com