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

Occurs 0

Former Member
0 Likes
659

Hi frnds,

Can any one tell me like in real time do we give " occurs 0 " statement for intializing memory to internal tables.

plzz explain...

regards,

sahakla

1 ACCEPTED SOLUTION
Read only

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert
0 Likes
632

As far as I know, specifying OCCURS 0 will allow the system to decide about the memory management of the internal table, instead of reserving memory space for a predefined number of entries like in case of, say, OCCURS 10.

By the way, the OCCURS parameter is considered to be obsolete in ABAP Objects, so it's probably better to use a different internal table declaration method everywhere such as ...TABLE OF...

3 REPLIES 3
Read only

amit_khare
Active Contributor
0 Likes
632

No, as per the updated specs we dont use any more this type of declarations with header lines instead we declare Table Types then declare internal table and work area to populate it.

Types: begin of type_tab,

matnr type mara-matnr,

end of type_tab.

types: type_t_tab type satndard table of type_tab.

data: t_tab type type_t_tab,

wa_tab type type_tab.

Regards,

Amit

Reward all helpful replies.

Read only

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert
0 Likes
633

As far as I know, specifying OCCURS 0 will allow the system to decide about the memory management of the internal table, instead of reserving memory space for a predefined number of entries like in case of, say, OCCURS 10.

By the way, the OCCURS parameter is considered to be obsolete in ABAP Objects, so it's probably better to use a different internal table declaration method everywhere such as ...TABLE OF...

Read only

Former Member
0 Likes
632

hii

occurs 0 is an old way of defining internal tables,now we define a table type by using code

types: begin of struct,

fld1 type x,

fld2 type y,

fld3 type z,

...

end of struct.

data : itab type table of struct.

data : wa_tab type struct.

hence we get the itab and wa with the same structure,

now coming back to occurs 0,

in occurs zero system desides the no of lines of the itab dynamically if say you want to enter 10 records then after inserting every record it will increase the no of lines of itab by 1,instead of occurs zero you can also write occurs 5 or 10 or anything but if this case it will use up more memory.

example if you use occurs 10 then for an itab with 11 lines after entering the 10th line it will again add 10 blank rows to the itab, keeping 9 rows blank,

i guess now you are clear with itab declarations and OCCURS statement,

please reward point if useful.