Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

About LIKE

Former Member
0 Kudos

Hi Experts,

Why LIKE is obsolete in ABAP?

plz someone help me to know this.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

3 REPLIES 3

Former Member
0 Kudos

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.

former_member206377
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Well not exactly sure. May be SAP dint like LIKE

Try to google and check