Skip to Content
author's profile photo Former Member
Former Member

internal and workarea

Hi all

is there any specific reason to use workarea...and in what way its going to help the performance.

Thanks and regards

vijaya

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Sep 22, 2006 at 08:28 AM

    Hi,

    Using a internal table with HEADER LINE ( Using OCCURS statement makes it difficult to understand whether you are referring the header data or the body. So clearing the work area is sometimes confusing.

    Declaring explicit workarea makes it easy to understand the code. Hence explicit work area is preferred over OCCURS statement.

    You can use either of the two. It does not affect performance in anyway. Only a matter of convenience in understanding the code and reviewing the code.

    Best regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 08:28 AM

    Hi

    If you want to read an internal table you need to use a work area.

    I don't believe to use or not to use a workarea can improve the performace, but it's only a problem of memory space: if you declare a table with workarea and don't use it, you've assigned to it a space too and won't use it.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 08:29 AM

    Avoid unnecessary assignments to the header line when using internal tables with a header line. Whenever possible, use statements that have an explicit work area.

    For example, "APPEND wa TO itab." is approximately twice as fast as "itab = wa. APPEND itab.". The same applies to COLLECT and INSERT.

    It is better to create internal table without header, and then perform all operations using the workarea.

    Also if you are looping larger internal tables, declare that work area as field symbol and loop the table in to field symbol. So that the performance will increase.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 08:31 AM

    Hi,

    While adding or retrieving records to / from internal table we have to keep the record temporarily.

    The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.

    Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.

    e.g.

    data: begin of itab occurs 10,

    ab type c,

    cd type i,

    end of itab. " this table will have the header line.

    data: wa_itab like itab. " explicit work area for itab

    data: itab1 like itab occurs 10. " table is without header line.

    The header line is a field string with the same structure as a row of the body, but it can only hold a single row.

    It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2006 at 08:33 AM

    Hi ,

    To store the values of an internal table temporarily workarea is required.

    You can use the option header line to have a workarea for an internal table .

    The structure of the header line is same as the internal table and it can hold only one row at a time.It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.

    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.