About OCCURS

Now we have to look at the syntax of internal table :


DATA : BEGIN OF <Internal table name> OCCURS  <n>,
           <Field Structure / Line Type>,
           END OF < Internal table name >.

here OCCURS <n> doesn't limit the number of rows that can be added to the internal table. For example, if you specify OCCURS 5, you can put more than 5 rows into internal table. The number of rows you can put into an internal table is theoretically only limited by the amount of virtual memory available on the application server.

The system uses the  OCCURS <n> clause only as a guideline to determine how much memory to allocate. The first time a row is added to the internal table, enough memory is allocated to hold the number of rows specified on the OCCURS <n> clause, If you use that memory up, more is allocated as needed.

Alternatively, you can specify OCCURS 0. If you do this, the system allocates 8KB pages of memory at a time. However, there are no advantages to using OCCURS 0 other than the fact it is only a little easier to code OCCURS 0 than it is to estimate the size of the internal table.

NOTE : Don't use OCCURS 0 if you expect to store less than 8KB in an internal table. If you do, the system will allocate 8KB from the paging area. Memory will be wasted and paging could increse, resulting in poorer performance.  

3 comments:

  1. I NEED A CLEA DESCRIPTION IN OCCURS 0,N

    ReplyDelete
  2. megha ajee do not use OCCURS 0, is an obsolete statement

    ReplyDelete
  3. The information provided here is of great use as I got to learn new things. Keep blogging.
    SAP ABAP TRAINING IN HYDERABAD

    ReplyDelete