2008 Aug 12 7:02 AM
Hi - if i'm using occurs 1 and 2 in diff program.....and query returns 10 records .......which program will be efficient occurs 1 or 2 ?
2008 Aug 12 7:05 AM
Hi
Occurs N menas how much memroy is allocated for ITAB. if N = 2 so memroy for 2 records is allocated everytime.
If its is fixed that you will get say 5 records every time then choose occurs 5 otherwise occurs 1 is efficient.
Aditya
Hi - if i'm using occurs 1 and 2 in diff program.....and query returns 10 records .......which program will be efficient occurs 1 or 2 ?
2008 Aug 12 7:05 AM
Hi
Occurs N menas how much memroy is allocated for ITAB. if N = 2 so memroy for 2 records is allocated everytime.
If its is fixed that you will get say 5 records every time then choose occurs 5 otherwise occurs 1 is efficient.
Aditya
2008 Aug 12 7:07 AM
Hi,
Try using occurs 0, such that it can handle N number of records.
Sharin.
2008 Aug 12 7:09 AM
Hi ,
http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3660358411d1829f0000e829fbfe/frameset.htm.
In this refer , Initial Memory Requirement.
2008 Aug 12 7:08 AM
2008 Aug 12 7:08 AM
Look at this for ur understanding. It may be helpfull for you.
Initial Memory Requirement
You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following addition:
INITIAL SIZE n
. This size does not belong to the data type of the internal table, and does not affect the type check. You can use the above addition to reserve memory space for n table lines when you declare the table object.
When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated.
You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= n<= 100.
It only makes sense to specify a concrete value of nif you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
To avoid excessive memory requests, large values for nare treated as follows: The possible maximum value for n results from 8 kilobyte divided by the row length. If you specify a larger value of n, the system calculates a new value so that ntimes the line width is around 12KB.
TYPES: BEGIN OF line,
column1 TYPE i,
column2 TYPE i,
column3 TYPE i,
END OF LINE.
TYPES itab TYPE SORTED TABLE OF line WITH UNIQUE KEY column1.
The program defines a table type itab. It is a sorted table, with line type of the structure line and a unique key of the component column1.
TYPES vector TYPE HASHED TABLE OF i WITH UNIQUE KEY table_line.
TYPES: BEGIN OF line,
column1 TYPE i,
column2 TYPE i,
column3 TYPE i,
END OF line.
TYPES itab TYPE SORTED TABLE OF line WITH UNIQUE KEY column1.
TYPES: BEGIN OF deepline,
field TYPE c,
table1 TYPE vector,
table2 TYPE itab,
END OF deepline.
TYPES deeptable TYPE STANDARD TABLE OF deepline
WITH DEFAULT KEY.
The program defines a table type vector with type hashed table, the elementary line type i and a unique key of the entire table line. The second table type is the same as in the previous example. The structure deepline contains the internal table as a component. The table type deeptable has the row type deepline. Therefore, the elements of this internal table are themselves internal tables. The key is the default key - in this case the column field. The key is non-unique, since the table is a standard table.
2008 Aug 12 7:09 AM
Hi Rodeny
This is not the case as if Occurs N means that you dnt know how much memory is to be used so a memory of 1 Page ie 8kb is allocated .
occurs 1 is more efficient than 2 if you are getting same result .
Regards
Hitesh
2008 Aug 12 7:14 AM
Hi,
data: begin of itab occurs n,
...,
end of itab.
Occurs N means how much memory is allocated for internal table itab. if N = 2 so memory for 2 records is allocated everytime.
Whenever space s required it will get added in that range i.e if 2 then 2 records and so on. If we declare 1o then 10 records every time are added. To avoid wastage of memory we cab declare it to minimum , so Occurs 1 is more efficient to declare.
Hope this helps.
thanx,
dhanashri.
2008 Aug 12 7:14 AM
Hi Rodney,
when you declare -
data: begin of gt_table occurs (N),
matnr type matnr,
end of gt_table.
here N represents the number of rows added to the internal table each time a new record is added to the internal table which will hold the memory.
Suppose, if N = 1, then each time a new record is appended into the the internal table. A additional row is added to the internal table.
____________________________________________________
GTTABLE CONTENTS_______________________________ |
FIELD - MATNR_______________________________________ |
000000000000000001__________________________________ |
____________________________________________________ |
in the above diagram, material number 1 is appended into the internal table a additional row will be added to the internal table which will hold a memory location of size 18.
you can try declaring a structure using TYPES statement and then use a DATA statement to declare a internal table which will not have a header line. it will just have a body to hold the contents.
example: TYPES: begin of ty_table,
matnr type matnr,
end of ty_table.
DATA: gt_table type STANDARD TABLE OF ty_table.
Regards,
Vamsi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |