Ansicht
Dokumentation

ABENCL_ABAP_WEAK_REFERENCE - CL ABAP WEAK REFERENCE

ABENCL_ABAP_WEAK_REFERENCE - CL ABAP WEAK REFERENCE

CPI1466 during Backup   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.
SAP E-Book

Weak References

An object in the system class CL_ABAP_WEAK_REFERENCE represents a weak reference to an object in a class. Unlike regular object references, a weak reference is ignored when the garbage collector is executed. This means that a weak reference does not keep the referenced object from being deleted when the garbage collector is executed.

A weak reference to an existing object is created by passing an object reference to the instance constructor of CL_ABAP_WEAK_REFERENCE. The functional method GET can then be used to retrieve the reference afterwards. If the object was deleted in the meantime, the return value is initial.

Note

A different type of reference keeps objects alive until the available memory becomes limited. The class CL_ABAP_SOFT_REFERENCE is designed for these soft references, but this class is currently still implemented like the class CL_ABAP_WEAK_REFERENCE.

Example

A weak reference is set to the object of the object reference variable oref, and the latter is then deleted. The weak reference points to the object for as long as the garbage collector is not executed. The return value is initial after the explicit call of the garbage collector.






General Data in Customer Master   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 1957 Date: 20240425 Time: 001946     sap01-206 ( 44 ms )