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: 

what is the difference between like line of and type....

Former Member

Hi all

can any body explain the difference between

DATA : t_caufv TYPE STANDARD TABLE OF caufv,

<b> wa_caufv LIKE LINE OF t_caufv.</b>

<b>( and ) </b>

DATA: it_aufk TYPE TABLE OF t_aufk,

<b> wa_aufk TYPE t_aufk.</b>

Message was edited by:

ABAPER1234

1 ACCEPTED SOLUTION

matt
Active Contributor

Functionally, no difference. It's a matter of taste and style. Sometimes you want to emphasise that the work area is used for a line of a table, so you'll use like, rather than the actual type. It saves you as a programmer, from having to look up the actual type, and it also provides a semantic (meaning) link between different data structures.

matt

5 REPLIES 5

Former Member
0 Kudos

Hi

<b>Like line of</b> is used to define a work area.

for ex : we have an internal table it_tab

data :it_tab type table of MARA initial size 0.

Now we define a work area for it_tab with name wa_tab

data : wa_tab like line of it_tab.

<b>TYPE-</b>you assign datatype directly to the data object while declaring.

Former Member
0 Kudos

DATA : t_caufv TYPE STANDARD TABLE OF caufv,

wa_caufv LIKE LINE OF t_caufv.

Ans: wa_caufv is the work area for internal table t_caufv, which will hold only one line of t_caufv at a time.

DATA: it_aufk TYPE TABLE OF t_aufk,

wa_aufk TYPE t_aufk.

Ans: this is also the same but you need to define the User defined type t_aufk.

Regards,

Satish

matt
Active Contributor

Functionally, no difference. It's a matter of taste and style. Sometimes you want to emphasise that the work area is used for a line of a table, so you'll use like, rather than the actual type. It saves you as a programmer, from having to look up the actual type, and it also provides a semantic (meaning) link between different data structures.

matt

Former Member
0 Kudos

HI

LINE OF can be used if type is a table type or if dobj is an internal table. If this addition is used, dtype inherits the properties of the line type of the internal table.

TYPE-you assign datatype directly to the data object while declaring

Former Member
0 Kudos

The first form has a slight advantage that if (for some reason) you change the type of the table, the workarea also changes.