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: 

structure,internal table

Former Member
0 Kudos
89

I am a bit confused with structures , internal tables without header line and with header line. what is the difference between these three. Also when does a internal table is said to have header line. plzz help me

1 ACCEPTED SOLUTION

Former Member
0 Kudos
51

HI,

Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm

Difference between Work Area and Header Line

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

1) The difference between

whih header line and with out heater line of internal table.

ex:-

a) Data : itab like mara occurs 0 with header line.

b) Data: itab like mara occurs 0.

-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.

a) Data : itab like mara occurs 0 with header line.

table is with header line

b) Data: itab like mara occurs 0.

table is without header line

2)work area / field string and internal table

which one is prefarable for good performance any why ?

-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 , whereas internal table can have more than one record.

In short u can define a workarea of an internal table which means that area must have the same structure as that of internal table and can have one record only.

Example code:

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.

Regards,

Laxmi.

2 REPLIES 2

Former Member
0 Kudos
52

HI,

Internal tables are a standard data type object which exists only during the runtime of the program. They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/content.htm

Difference between Work Area and Header Line

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

1) The difference between

whih header line and with out heater line of internal table.

ex:-

a) Data : itab like mara occurs 0 with header line.

b) Data: itab like mara occurs 0.

-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.

a) Data : itab like mara occurs 0 with header line.

table is with header line

b) Data: itab like mara occurs 0.

table is without header line

2)work area / field string and internal table

which one is prefarable for good performance any why ?

-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 , whereas internal table can have more than one record.

In short u can define a workarea of an internal table which means that area must have the same structure as that of internal table and can have one record only.

Example code:

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.

Regards,

Laxmi.

Former Member
0 Kudos
51

Hi,

Both are tables,

but the difference is:

Internal table : its defined and used

in abap program and is part of run time memory

structure : its defined first in data dictionary.

A structure when used in a Program provides you with a work area that enables you to hold one record at a time.

An internal table can hold more than one record during the runtime of the Program. When you loop AT an itab, one record is moved into its HEADER in every loop pass.

Hope this helps..

Regards,

KK