Application Development and Automation 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: 
Read only

Difference between LIKE and TYPE

former_member691206
Discoverer
0 Likes
516

Hi,

I am new to ABAP .. I may sound stupid with this question.. What is the difference between TYPE and LIKE ... could anyone explain to me with examples..

Thanks,

Manasa

Moderator message: please search for available information before asking.

locked by: Thomas Zloch on Sep 15, 2010 11:28 AM

2 REPLIES 2
Read only

Former Member
0 Likes
488

In modern ABAP development you should not use LIKE addition to declare variables. LIKE was used to reference ABAP Dictionary types. Nowadays you should use TYPE. There is one exception, though. You can use LIKE when you reference existing data objects (variables, internal tables), for example:

DATA: l_tab_po_items TYPE po_items,
      l_wrk_po_items LIKE LINE OF l_tab_po_items.

But besides this exception, forget about LIKE. In OO-context LIKE is forbidden (except referencing a data object).

Regards

Edited by: Krzysztof Usowicz on Sep 15, 2010 11:19 AM

Read only

Former Member
0 Likes
488

hi,

Please search SDN before posting. but for your reference check the following

[;

[;

Regards,

Sakshi