‎2014 Apr 24 5:16 PM
Hi ,
I have the following code.
DATA: r_plane TYPE REF TO lcl_airplane,
CREATE OBJECT r_plane EXPORTING im_name = 'LH Berlin'
im_planetype = 'A321'.
CREATE OBJECT r_plane EXPORTING im_name = 'LH Frankfurt'
im_planetype = '747-400'.
Here both the object instance name is r_plane ...Does this mean that ABAP will internally create two objects with the same reference "r_plane"
Or will it just overwrite the existing instance.
‎2014 Apr 25 6:07 AM
Hi Hema,
ABAP will overwrite the first reference with the second reference in r_plane, since you are using the same reference Variable. ie., r_plane contains reference to new parameters of LH-FRANKFRUT and planetype 747-400.
Old reference gets overwirted.
Regards,
Ravikiran.K
‎2014 Apr 24 5:33 PM
Hi,
One of the nicest thing about this profession is that we can try things without killing any one in the process....
Do a test....
Regards.
‎2014 Apr 24 5:46 PM
After second instance creation, first one will enter zombie/limbo state. It will exist for a while, without having any way to interact with us because of lack of reference, and finally it will be gobbled up by the garbage collector.
‎2014 Apr 24 6:36 PM
‎2014 Apr 25 7:06 AM
‎2014 Apr 25 6:07 AM
Hi Hema,
ABAP will overwrite the first reference with the second reference in r_plane, since you are using the same reference Variable. ie., r_plane contains reference to new parameters of LH-FRANKFRUT and planetype 747-400.
Old reference gets overwirted.
Regards,
Ravikiran.K