‎2008 Apr 21 12:05 PM
Why 'Occurs 0' is obsolete and what is the reason we declare few statements as obsolete?
‎2008 Apr 21 12:17 PM
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.
‎2008 Apr 21 12:10 PM
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.
‎2008 Apr 21 12:17 PM
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.
‎2008 Apr 21 12:19 PM
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