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

Regarding header line

Former Member
0 Likes
1,036

Hi ,

Can any one explain me about the difference between internal table with header line and without header line .

What difference this header makes in a internal table .

Thanks ,

vinay .

Hi ,

Can any one explain me about the difference between internal table with header line and without header line .

What difference this header makes in a internal table .

Thanks ,

vinay .

10 REPLIES 10
Read only

dani_mn
Active Contributor
0 Likes
997

HI,

Header line is the work area of the internal table. a internal with header line have a work area by default, and when you loop on the internal table with header line you don't need to mention work area data goes to header line.

like

LOOP AT ITAB.

*data goes to header line for each loop pass.

ENDLOOP.

Internal table without header line have no work area so you have to mention a work area when you are using them.

like

LOOP AT itab INTO wa_itab.

  • data goes to work area

ENDLOOP.

Regards,

HRA

Read only

naimesh_patel
Active Contributor
0 Likes
997

Hello,

If you have an internal table without header line then you have explicitly define a work area for that.

Like,

loop at itab into wa_itab.

endloop.

If you try to use ,

loop at itab. << system gives an error... that specify work area.

regards,

Naimesh

Read only

Former Member
0 Likes
997

Hi,

Internal table with header line can be used in LOOP at.

We can append the header to add new row and MODIFy the existing row.

Without header line cannot be used in loop at.

Regards,

Viven

Read only

0 Likes
997

when you declare a internal table using "Begin of" by default u will have a header to ur internal table.

I suggest you write a sample program by using above replies, debug the program and you can compare both internal table with header and without header.

Cheers,

Sanjay

Read only

Former Member
0 Likes
997

an internal table with header line would use a header or work area with the same name as the internal table for some processing to be done.

for example , you have an internal table in which you have 10 records.

YOu have to modify a value in 7th record.

read table itab index 7.

  • The above satement would get the 7th record into the header work area.

*From now onwards, you can use itab as just another structure which has one record in it with all the fields in the internal table(In this case the 7th record

If you uuse an internal table without header line, then you have to use a structure/explicit work Area to do the processing on particu;ar records.

like:

read itab into xtab index 7.

*Now xtab will have the 7th record.

In short,

an internal table with header = an internal table without header line + a work area which has the same structure as the internal table.

Regards,

Ravi

Read only

Former Member
0 Likes
997

to process internal table data(records) you need some thing to store that record. for that purpose HEADER LINE appears.

if you read any entry from the internal table(either by using LOOP AT ITAB or READ TABLE ITAB) , the record will be fetched from the internal table body to the header line.

if you define an internal table with header line, the above record will be placed there.

if you create an internal table WITHOUT header,you should explicitly mention where to place the fetching record

from the body.

regaards

srikanth

Read only

Former Member
0 Likes
997

Hi,

If you have declared an internal table with header line , then any read statement or Loop statement made on the table writes the value into its header .

For Eg. IF you declare a table i_itab with header line

Then you can make a read/loop statement like

read table i_itab with key ....

or

Loop at i_tab where ...

Its not required to specify 'INTO work area'

The value will be there in its header , which you can get by accessing i_itab-*

Effectively a declaration of internal table with header line creates a table along with a work area of the same name.

Sreejesh P.

NB: Award points if found helpful

Read only

Former Member
0 Likes
997

hi Vinay,

An Internal table without header line have no work area. Thus we need to provide an explicit work area when we are using them.

LOOP AT itab INTO X_ITAB.

  • Now the data goes to the explicit work area x_itab

ENDLOOP.

Header line is the implicit work area of the internal table. An internal with header line have a work area by default, and when you loop on the internal table with header line you don't need to provide the work area data goes to header line.

LOOP AT ITAB.

*the data goes to header line(default workarea which has the same name itab) for each loop pass.

ENDLOOP.

Its always a better practise to use explicit workareas.

Regards,

Richa

Read only

Former Member
0 Likes
997

Vinay,

HEADER LINE is an implicit work area declaration, by which you can address the header line by the same name as your internal table.

Internal Table without header line are to addressed with a work area and you`ll have to address the work area by its name and not by the internal table name.

Hope this is of any help, reward points if so.

Regards

Read only

Former Member
0 Likes
997

Hi Vinay,

internal table with header line means it internally creates a workarea for header line

internal table with out header line for this you have to create work area explicitly.

Thanks

Vikranth Khimavath