Skip to Content
0
Former Member
Aug 28, 2006 at 10:59 PM

TYPE or LIKE when using the internal table for ALV?

28 Views

Hi all,

I have a doubt about alv programs. Why does it work ONLY when the main internal table's (ie which contains the data to be displayed, (here itab_t001)) fields are declared with 'LIKE' ? and not if 'TYPE' is used. It does not give any error with 'TYPE' but does not show the ALV grid either. Why?

ie if you use:

TYPES: BEGIN OF t_t001,
  bukrs TYPE t001-bukrs, "company code
  butxt TYPE t001-butxt, "company name
END OF t_t001.

DATA: wa_t001 TYPE t_t001,
      itab_t001 TYPE t_t001.

it will not work but if you use:

DATA: BEGIN OF wa_t001,
  bukrs TYPE t001-bukrs, "company code
  butxt TYPE t001-butxt, "company name
END OF wa_t001.

DATA: BEGIN OF itab_t001 OCCURS 0,
      bukrs LIKE wa_t001-bukrs, "company code
      butxt LIKE wa_t001-butxt, "company name
END OF itab_t001.

it works fine..

Thanks.

Charles.

+++++++++++++