Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Work Area

Former Member
0 Likes
2,096

Hi,

What is the difference between defining internal table with work area and with out work area.

Regards,

Naga

10 REPLIES 10
Read only

Former Member
0 Likes
1,122

Hi,

[Using Header Lines as Work Areas|http://help.sap.com/saphelp_nw70/helpdata/EN/fc/eb36a1358411d1829f0000e829fbfe/frameset.htm]

Regards Rudi

Read only

Former Member
0 Likes
1,122

You need a work area to be able to read data out of a table or to loop at a table. Technically you can create a table without a work area, but once you want to access the table (add, modify, delete data) you will need a work area of the same structure as the table.

Hope that explains it.

Read only

0 Likes
1,122

Performance wise, which is better with header or with header and what is the reason behind that?

Read only

0 Likes
1,122

As per SAP Standards..We need to create a Structure first and Create Internal table and Work area for that Structure.

Performance wise Using work area is better..becaz only header line will be there instead of dealing with whole internal table.

Read only

Former Member
0 Likes
1,122

Hi Rams,

You can define internal tables either with (WITH HEADER LINE addition) or without header lines.

An internal table with header line consists of a work area (header line) and the actual table body. You address both objects

using the same name. The way in which the system interprets the name depends on the context. For example, the MOVE statement applies to the header line, but the SEARCH statement applies to the body of the table.

To avoid confusion, you are recommended to use internal tables without header lines. This is particularly important when you use nested tables. However, internal tables with header line do offer a shorter syntax in several statements

( APPEND, INSERT, MODIFY, COLLECT, DELETE, READ, LOOP ).

Within ABAP Objects, you can only use internal tables without a header line. You can always address the body of an internal table <itab> explicitly by using the following syntax: <itab>[]. This syntax is always valid, whether the internal table has a header line or not.

Example

DATA itab1 TYPE TABLE OF i WITH HEADER LINE.

DATA itab2 TYPE TABLE OF i WITH HEADER LINE.

itab1 = itab2.

" Only header lines will be copied

itab1[] = itab2[].

" Copies table body

Hope this helps you.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,122

Hi,

Technically speaking you can create an internal table without workarea,but to use that internal table you need to define a workarea for the same.

I doubt there is a performance difference when looping into either the header line or a work area. In both cases you transfer data into another structure. However, it is better programming to use tables without header lines. Simply because if you use header lines, you have ambiguity. ITAB could mean the table, or the header. And ambiguity is programming is BAD.

http://sap.mis.cmich.edu/sap-abap/abap04/sld012.htm

Regards,

Manish

Read only

Former Member
0 Likes
1,122

Hi,

The optional addition WITH HEADER LINE declares an extra data object with the same name and line type as the internal table. This data object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate this by placing brackets after the table name (itab[]). Otherwise, ABAP interprets the name as the name of the header line and not of the body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.

http://www.sap-img.com/abap/with-header-without-header-internal-table.htm

Regards,

Sujit

Read only

Former Member
0 Likes
1,122

Hi There.

I would like to suggest,

The internal table without header line is most efficient performance wise as time taken by is very less compared to that with header line.

Hope that's usefull.

Good Luck & Regards.

Harsh Dave

Read only

Former Member
0 Likes
1,122
Read only

Former Member
0 Likes
1,122

Thans for all your replies