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: 

what is the diferences between with header line and without headerline?

Former Member
0 Kudos

hi exports,

what is the diferences between with header line and without headerline?

regards

paramesh

11 REPLIES 11

Former Member
0 Kudos

With header line means there will be one field string as the same structre of the table, and we can use it as work area for tht internal atable.

with out header line means u need to create one external fieldstirng for work area of tht internal table

Former Member
0 Kudos

HI,

you have different function in using the internal table if you work with and without header-line.

e.g.

with header-line

You can loop over the internal table and your current dataset stands in the header, where you can modify, delete or insert new datas.

without header-line is like work with an structure

Regards

Nicole

Former Member

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.


TYPES vector TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line.

DATA: itab TYPE vector,
      jtab LIKE itab WITH HEADER LINE.

* MOVE itab TO jtab.   <-  Syntax error!

MOVE itab TO jtab[].

The table object itab is created with reference to the table type vector. The table object jtab has the same data type as itab. jtab also has a header line. In the first MOVE statement, jtab addresses the header line. Since this has the data type I, and the table type of itab cannot be converted into an elementary type, the MOVE statement causes a syntax error. The second MOVE statement is correct, since both operands are table objects

Refer this Link-

http://www.sap-img.com/abap/difference-between-work-area-and-header-line.htm

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb367a358411d1829f0000e829fbfe/content.htm

Regards,

Sujit

Former Member
0 Kudos

Hi,

Internal tables can be declared with or without header line. Header line is nothing but the workarea for the internal table.

For declaring internal table without header line, you define a table type.

types: begin of ty_tab1,

ebeln like ekko-ebeln,

ebelp like ekpo-ebelp,

menge like ekpo-menge,

end if ty_tab1.

Now declare an internal table for the above defined table type.

data: it_tab1 type STANDARD TABLE OF ty_tab1.

This statement creates only the table body. to create the work area explicitly use the following statement.

data: wa_tab1 type ty_tab1.

To define an internal table with both table body and work area we use.

data : it_tab1 type standard table of ty_tab1 with header line.

IF you are using older versions you can also use the following definitions;

data: begin of it_tab1 occurs 0,

ebeln like ekko-ebeln,

ebelp like ekpo-ebelp,

mene like ekpo-menge,

end of it_tab1.

This statement creates both table body and work area.

Hope the above info is useful.

Regards,

Mohammed

Former Member
0 Kudos

Hi,

In case of 'With Header Line' work area of the internal table is automaticaly created with the creation of the Internal table.

wheras In case of 'Without Header Line' work area of the internal table is required to be created explicitly.

Former Member
0 Kudos

Hi paramesh,

They are just two different ways of declaring internal tables.When an internal table is declared with a header line a work area gets created automatically unlike the internal table without header line.

Internal table with header line

A header line is a work area whose data type is the row type of the internal table and whose name is the name of the internal table. You should not use this possibility, because then two data objects with the same name exist in the ABAP program. Instead of a header line, you can simply create an explicit work area using the addition LINE OF of the statements TYPES, DATA etc.

It is an obsolete work area of an internal table, that has the type of the line type and the same name as the internal table. If an internal table with a header line is used in an operand position, the header line is usually addressed. To enforce access to the table body, square brackets [] can be entered after the name.

Best of luck,

Bhumika

Former Member
0 Kudos

Hi,

without header line means we have to create a workarea with the type of that internal table .

with header line means it automatically creates a workarea with the same name of the internal table.

Former Member
0 Kudos

Hi,

Header line is a work area to the internal table by this you need not have a explicit work area to change/modify the data in the internal table , and without header line, to change any data in the internal table you need to create explicit work area.

Thanks,

Sriram POnna.

Former Member
0 Kudos

Former Member
0 Kudos

Hi Paramabap,

when you declare a internal table with header line that means a work area with the same name as the internal table is created internally that is implicitly in your program,

however when you create a internal table without header line than you have to create a header line that is a work area explicitly in your program, as to access a internal table you always need a work area.

With Regards,

Pritam.

Former Member
0 Kudos

Hi,

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.

Now 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

So in all with headerline line is with an explicit workarea and without headerline in without an explicit workarea for such cases we declare workarea if needed.

Example :

TYPES: begin of itab,
            f1 type tbl-f1...........
            end of itab.

DATA: it_tab type standard table of itab,
          wa_itab like line of it_itab.      " Explicit workarea.

Hope this clears the doubt.

plz reward if useful

thanks,

dhanashri.