Skip to Content

doubt in ITAB

hi all ,

can anybody tell me what is difference in

data : begin of itab occurs 0, and data : begin of itab occurs 10, and data : begin of itab occurs 100 ,.

what it will do ?

thanks in advance .

regards saurabh .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:19 AM

    Hi,

    There is difference in memory alocation.

    Occurs '100' allocates the memory for 100 records each time.

    This is not a fixed memory. Each time it allocates 100 records dynamically.

    Occurs '0' allocates full memory (8kb).

    So if you have small amount of data in the internal table, then make use of occurs N otherwise use occurs 0.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:22 AM

    Hi saurabh,

    OCCURS 10 actually allocates memory space for 1 line of the internal table. OCCURS 0 allocates no memeory space when the internal table is created. The memeory space is allocated when filling the internal table.

    Really, you should not be using the OCCURS extension when defining internal tables as it is obselete. You should define a type instead.

    codeTypes: begin of ttab,

    fld1 type c,

    end of ttab.

    data: itab type table of ttab.

    data: wa like line of itab.[/code]

    REgards,

    Mukesh Kumar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:22 AM

    Hi,

    OCCURS addition had the same meaning as in the INITIAL SIZE addition. Entering ‘0’ had the same effect as omitting the INITIAL SIZE addition. In this case, the initial size of the table is determined by the system.

    If you specify no. as 10 or 100, the initial size of itab occupies 10 or 100 but it extends when you add records more than the initial size. This is in particular for reducing memory allocation and improve performance.

    Reward points if helpful

    Regards,

    kamalapriya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:23 AM

    Hi,

    Occurs 0 with header line will create internal table with header line , but 0 stands for intially it will create space for only one record. It doesn't mean that it will insert only one record.

    But intially sapce available will be one.

    Similarly Occurs 10 will have intial space created into your internal table immediately after its creation is 10. i.e 10 records space.

    I hope its clear for you,

    Do reward,

    Thanks,

    Madhura N.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:24 AM

    hi,

    occurs 0 allocate 8kbytes of memory and occurs 10 allocates memory which is required for 10 records when 11 records comes then with that 10 records space it will allocate another 10 records space

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:28 AM

    Hi,

    there is memory allocation difference, occurs 0 will give default memory allocation of 64kb and remaining occurs 100 wil allocATE 100 LINES OF MEMORY ALLOCATE sufficient for 100 lines.

    PLZZ REWARD POINTS IF IT HELPS

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:28 AM

    Hi Sri,

    occurs 0 : It creates the body of the internal table with infinite length.It can store datain continous memory location.

    occurs 10: It can store first 10 records in continous memory location other records are store in some where else in memory..

    Reward points if helpful.

    Kiran Kumar.G.A

    Have a Nice Day..

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 17, 2008 at 05:29 AM

    Hi Saurabh,

    When you use Occurs 0, it will utilize std block of ABAP memory , when your corresponding internal table fill this space memory again utilize second block again.

    Now when you use occurs 10 , your table utilize memory which will good enough to occupied 10 number of records. If your record fo beyond 10 than it will again utilize memory for 10 records. So it will like block memory like this.. 10 ...10...10 ..go on ...

    So it's recommened that if you are sure that your table will have more number of recorf use occurs 0 and if you have estimate of n record than use occurs n.

    Hope you understand.

    Regards

    Nimesh S. Patel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 05:31 AM

    Hi Srivatsav,

    OCCURS 0:It will create the body of the internal table with infinite length.And the records are stored in continous memory location.

    OCCURS 10: It will store first 10 records in continous memory location and the remaining records are stored in some where else in the memory.(We will get some performance issue problem if we use occurs 10).

    Reward points if helpful.

    Kiran Kumar.G.A

    Have a Nice Day..

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.