09-22-2006 9:25 AM
Hi all
is there any specific reason to use workarea...and in what way its going to help the performance.
Thanks and regards
vijaya
09-22-2006 9: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
09-22-2006 9: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
09-22-2006 9: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
09-22-2006 9: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.
09-22-2006 9: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
09-22-2006 9: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.