‎2009 Dec 02 7:06 AM
Hi Experts,
Why LIKE is obsolete in ABAP?
plz someone help me to know this.
Thanks in advance.
‎2009 Dec 02 7:20 AM
Hi,
Abap is more moving into object oriented approach.LIKE is an old convention. It should only be used in cases where a data declaration refers to an existing data object defined in your program. LIke is also commonly used for declaring the line type of an internal table i.e. LIKE LINE OF.
TYPE is a common convention found in most other modern programming languages. You should also follow this accepted convention. In OO porgramming, any reference to a dictionary type MUST use the keyword TYPE. LIKE will fail syntax check.
IN OO CONTEXT you need to use TYPE not LIKE.
‎2009 Dec 02 7:20 AM
Hi,
Abap is more moving into object oriented approach.LIKE is an old convention. It should only be used in cases where a data declaration refers to an existing data object defined in your program. LIke is also commonly used for declaring the line type of an internal table i.e. LIKE LINE OF.
TYPE is a common convention found in most other modern programming languages. You should also follow this accepted convention. In OO porgramming, any reference to a dictionary type MUST use the keyword TYPE. LIKE will fail syntax check.
IN OO CONTEXT you need to use TYPE not LIKE.
‎2009 Dec 02 7:20 AM
The LIKE addition is used only for data objects where as the TYPE addition is designed to be the only construct that enables references to data types. The repository objects in the ABAP Dictionary are data types but not data objects.
But outside of ABAP Objects the LIKE reference to database tables and flat structures in the ABAP Dictionary is still allowed (though termed as obsolete) for reasons of compatibility with previous releases.
‎2009 Dec 02 7:21 AM
Well not exactly sure. May be SAP dint like LIKE
Try to google and check