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

Obsolete Statement

Former Member
0 Likes
637

Why 'Occurs 0' is obsolete and what is the reason we declare few statements as obsolete?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
534

We know that occurs statement defines internal table size...if you declare occurs 0..the system allocates 8kb pages of memory to internal table..but if you have less number records then paging could increase and memory wasted..this may cause performance issue...thats why occurs 0 is a obsolete statement.

Reward if useful.

Dara.

3 REPLIES 3
Read only

Former Member
0 Likes
534

hi Radha,

declare it in the below fashion ...

Obsolete one

 
Data: Begin of i_tab occurs 0.
fld(1),
fld(2),
End of i_tab.
 

Changed one


types: Begin of ty_tab,
fld(1),
fld(2),
End of ty_tab.

data: t_itab type standard table of ty_tab.
data: st_itab type of ty_tab.
 

Read only

Former Member
0 Likes
535

We know that occurs statement defines internal table size...if you declare occurs 0..the system allocates 8kb pages of memory to internal table..but if you have less number records then paging could increase and memory wasted..this may cause performance issue...thats why occurs 0 is a obsolete statement.

Reward if useful.

Dara.

Read only

Former Member
0 Likes
534

Hi,

Table declaration (old method)

DATA: BEGIN OF tab_ekpo OCCURS 0, "itab with header line

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

END OF tab_ekpo.

*Table declaration (new method) "USE THIS WAY!!!

TYPES: BEGIN OF t_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

END OF t_ekpo.

DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0, "itab

wa_ekpo TYPE t_ekpo. "work area (header line)

  • Build internal table and work area from existing internal table

DATA: it_datatab LIKE tab_ekpo OCCURS 0, "old method

wa_datatab LIKE LINE OF tab_ekpo.

  • Build internal table and work area from existing internal table,

  • adding additional fields

TYPES: BEGIN OF t_repdata.

INCLUDE STRUCTURE tab_ekpo. "could include EKKO table itself!!

TYPES: bukrs TYPE ekpo-werks,

bstyp TYPE ekpo-bukrs.

TYPES: END OF t_repdata.

DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0, "itab

wa_repdata TYPE t_repdata. "work area (header line)

Reward If Helpfull,

Naresh