cancel
Showing results for 
Search instead for 
Did you mean: 

What is the difference between internal table and structure?

Former Member
0 Kudos

What is the difference between internal table and structure?

I searched in WIKI but it tell abt diff b/w table and structure

Could you pls answer this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

internal table is a table that we create during over program . strucure's cant hold data but internal tables can .

Thanks

Rohit

Reward if helpfull .

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Structure:

Structures are used to define the data at the interface of module pools and screens and to define the parameter types of function modules.

The central definition of structures that are used more than once makes it possible for them to be changed centrally. The active ABAP Dictionary then makes this change wherever required. ABAP programs or screen templates that use a structure are automatically adjusted when the structure is changed.

There are Flat, nested and deep structures. A flag structure only references elementary types. A nested structure references at least one further structure, but not a table type. A deep structure references at least one table type.

In a database table, you can only include flat structures as substructures.

A structure can have elements from different tables and structures. They do work similar to tables.

Please give me reward points if it is useful.