Application Development 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: 

header line

Former Member
0 Kudos

hi all,

What is the difference between with HEADER LINE & WITH OUT HEADER LINE.

For better performance which one I should use.

8 REPLIES 8

Former Member
0 Kudos

hi,

With Header Line includes the work area.

For better performance we should use With Header Line.

Former Member
0 Kudos

you shoukd use without header line for better performance...

u can get the line data of respective itab into work area or field symbols for processing...

Former Member
0 Kudos

Hi Ravi,

with header line usage would create an internal table with its headerline.

But it is always ideal to use an explicitly created header line as usage of with header line is an obsolete practice.

For better performance go for an explicit definition of the header line and do not use with header line in the internal table definition.

Reward points if this helps,

Kiran

gopi_narendra
Active Contributor
0 Kudos

with Header line includes the work area as well.

but the latest versions of SAP does not support either of two

the best way is :

  TYPES: BEGIN OF ty_emp,
           empid(4) TYPE c,
           ename(30) TYPE c,
           dept(4) TYPE c,
           grade(1) TYPE c,
           salary TYPE i,
         END OF ty_emp.

* TABLE TYPE
  DATA: it_emp TYPE TABLE OF ty_emp INITIAL SIZE 0,
        fs_emp TYPE ty_emp.

Regards

Gopi

Former Member
0 Kudos

Hello Ravi,

Header line is like work area. which means that... it can hold only one record with fields of your internal table ( order of the fields in header are same as the order of fields in internal table ) your internal table name represents the header.

Header line concept is not supported by OOPS, where most of the future reports will be in OOPS. So better to use work area.

Reward If Useful.

Regards

--

Sasidhar Reddy Matli.

Former Member
0 Kudos

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

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.

When you create an internal table WITH a header line, a work area is created automatically with the same data type as the rows of the internal table. The header line and the internal table have the same name. Then, the system uses this work area implicitly.

<b>We should generally avoid using header line because</b>

1. Creating a header line makes the code unreadable and complex as the internal table and header line have the same names.

2. Abap objects doesnt support internal tables with header line.

<b>Hope this is helpful</b>

Former Member
0 Kudos

Hi Ravi

internal table with header line means every operation is done through that header line itself.

for ex:

data: itab like mara occurs 0 with header line.

here itab with header line

loop at itab.

write:itab-matnr.

endloop.

every material number is printed from header line.

internal table without header line means u should use explicit work area

performance wise it is better beacuse u never specify the size as u speicfy size of internal table incase of with headerline as using occurs .

performance wise with out header line is better because u dont specify the size of internal table first itself.instead u use types declaration

for ex:

types: begin of itab1,

matnr like mara-matnr,

end of itab1.

data: itab type table od itab1,

wa type itab1.

here operations on itab is thru this work area.

loop at itab into wa.

write/ wa-matnr.

endloop.

regards

sandhya

Former Member
0 Kudos

When you create an internal table object you can also declare a header line with the same name. You can use the header line as a work area when you process the internal table. The ABAP statements that you use with internal tables have short forms that you can use if your internal table has a header line. These statements automatically assume the header line as an implicit work area.

Using the header line as a work area means that you can use shorter statements; however, they are not necessarily easier to understand, since you cannot immediately recognize the origin and target of the assignment. Furthermore, the fact that the table and its header line have the same name can cause confusion

even in performance wise the witout header line ( i mean with workareas ) are better.

reward points if helpful...