Skip to Content
0
Former Member
Aug 04, 2009 at 11:08 AM

Types statement

30 Views

Hi ABAP Experts,

I have some doubt on declaring Internal tables, could you tell me which case case1 or case 2 is correct.

Case1.

types: begin of t_kunnr,

name1(30) type c,

name2(30) type c,

kunnr(10) type c,

end of t_kunnr.

TYPES it_kunnr TYPE standard table of t_kunnr.

DATA: wa_kunnr TYPE t_kunnr.

DATA: it_kunnr type t_kunnr.

wa_kunnr-name1 = 'KK'.

wa_kunnr-name2 = 'MM'.

wa_kunnr-kunnr = '4999'.

append wa_kunnr to it_kunnr.

wa_kunnr-name1 = 'KK1'.

wa_kunnr-name2 = 'MM1'.

wa_kunnr-kunnr = '4999'.

append wa_kunnr to it_kunnr.

wa_kunnr-name1 = 'KK1'.

wa_kunnr-name2 = 'MM1'.

wa_kunnr-kunnr = '3999'.

append wa_kunnr to it_kunnr.

loop at it_kunnr into wa_kunnr.

write : / wa_kunnr-name1, wa_kunnr-kunnr.

endloop.

case2

types: begin of t_kunnr,

name1(30) type c,

name2(30) type c,

kunnr(10) type c,

end of t_kunnr.

DATA: wa_kunnr TYPE t_kunnr,

it_kunnr TYPE STANDARD TABLE OF t_kunnr.

wa_kunnr-name1 = 'KK'.

wa_kunnr-name2 = 'MM'.

wa_kunnr-kunnr = '4999'.

append wa_kunnr to it_kunnr.

wa_kunnr-name1 = 'KK1'.

wa_kunnr-name2 = 'MM1'.

wa_kunnr-kunnr = '4999'.

append wa_kunnr to it_kunnr.

wa_kunnr-name1 = 'KK1'.

wa_kunnr-name2 = 'MM1'.

wa_kunnr-kunnr = '3999'.

append wa_kunnr to it_kunnr.

loop at it_kunnr into wa_kunnr.

write : / wa_kunnr-name1, wa_kunnr-kunnr.

endloop.

Thanks in advance.