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

internal table

Former Member
0 Likes
741

Hello everybody

do we have to declare an workarea if i declare a internal table..is OCCURS obsolete.can anyone please help.

Thanks and Regards

vijaya

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
714

hi vijaya,

to make more claer.

look this.

data : itab like ztable occurs 0 with header line.

here work area and itab is created.

data : begin of itab,

age like ztable-age,

endof itab.

only itab is created , no work area.

data : begin of itab <b>occurs 0</b>,

age like ztable-age,

endof itab.

here itab and work area is created.

rgds

anver

if useful mark points

9 REPLIES 9
Read only

Former Member
0 Likes
714

Hello,

It depend on ur requirement wether to declare work area or internal table completely.

Without occurs it is work area and vice-versa.

What is ur requirement actually?

Regards

Read only

Former Member
0 Likes
714

Hi,

If u decalre internal table with header no need to declare work area.

internal table with header:

data: itab like mara occurs 0 with header line.

internal table with out header:

data: itab like mara occurs 0.

data: wa type itab. (Work area).

It is always advisable to use workarea.

Plz mark if useful

Regards

Divakar

Read only

dani_mn
Active Contributor
0 Likes
714

HI,

if you are declaring with syntax, <b>data: begin of itab.</b>

or with header line then you don't need to declare.

otherwise you have to.

From 4.7 it is recmended to declare with header line. and use of workarea.

REgards,

Read only

Former Member
0 Likes
714

Hi,

Yes , you have to declare work area if not using OCCURS while declaring internal table.

Best regards,

Prashant

Read only

0 Likes
714
types: begin of ty_itab,
field1,
field 2,
end of ty_itab.

data: itab type standared table of ty_itab.-->internal table without header line.
data: wa_itab like line of itab.--->work area
Read only

anversha_s
Active Contributor
0 Likes
715

hi vijaya,

to make more claer.

look this.

data : itab like ztable occurs 0 with header line.

here work area and itab is created.

data : begin of itab,

age like ztable-age,

endof itab.

only itab is created , no work area.

data : begin of itab <b>occurs 0</b>,

age like ztable-age,

endof itab.

here itab and work area is created.

rgds

anver

if useful mark points

Read only

Former Member
0 Likes
714

Hi!

Yes you are right! It is advisable to make a seperate Work area declaration as 'OCCURS' is Obsolete now.Typically as shown by Krishna Negi.

Read only

Former Member
0 Likes
714

Hello,

OCCURS is not obsolete. But suggestion is that don't use that. Instead go for types and then declare your internal table as below,

TYPES: BEGIN OF TY_MARA,

MATNR TYPE MATNR,

MTART TYPE MTART,

lv_xx TYPE c,

ENDOF TY_MARA.

DATA: lwa_mara type ty_mara, (Work Area)

lt_mara like standard table of lwa_mara.

(Int. tabel)

Regs,

Venkat Ramanan N

Read only

Former Member
0 Likes
714

Thanks all...

is there is any specific reason to use workarea..

regards

vj