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

Former Member
0 Kudos

hai SAP Guru's,

can any one give the difference between structure and internal table

8 REPLIES 8

Former Member
0 Kudos

Hi,

May be this ll help u.

<u><b>Structures</b></u>

A structure is a sequence of any elementary types, reference types, or complex data types.

You use structures in ABAP programs to group work areas that logically belong together. Since the elements of a structure can have any data type, structures can have a large range of uses. For example, you can use a structure with elementary data types to display lines from a database table within a program. You can also use structures containing aggregated elements to include all of the attributes of a screen or control in a single data object.

The following terms are important when we talk about structures:

Nested and non-nested structures

Flat and deep structures

A nested structure is a structure that contains one or more other structures as components. Flat structures contain only elementary data types with a fixed length (no internal tables, reference types, or strings). The term deep structure can apply regardless of whether the structure is nested or not. Nested structures are flat so long as none of the above types is contained in any nesting level.

Any structure that contains at least one internal table, reference type, or string as a component (regardless of nesting) is a deep structure. Accordingly, internal tables, references, and strings are also known as deep data types. The technical difference between deep structures and all others is as follows. When you create a deep structure, the system creates a pointer in memory that points to the real field contents or other administrative information. When you create a flat data type, the actual field contents are stored with the type in memory. Since the field contents are not stored with the field descriptions in the case of deep structures, assignments, offset and length specifications and other operations are handled differently from flat structures.

<u><b>Internal Tables</b></u>

Internal tables consists of a series of lines that all have the same data type. Internal tables are characterized by:

The line type, which can be any elementary type, reference type, or complex data type.

The key identifies table rows. It is made up of the elementary fields in the line. The key can be unique or non-unique.

The access method determines how ABAP will access individual table entries. There are three access types, namely unsorted tables, sorted index tables and hash tables. For index tables, the system maintains a linear index, so you can access the table either by specifying the index or the key.

Hashed tables have no linear index. You can only access hashed tables by specifying the key. The system has its own hash algorithm for managing the table.

You should use internal tables whenever you need to use structured data within a program. One imprint use is to store data from the database within a program.

And also go through this link:

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

Regards,

Deepika

Message was edited by:

Deepika Nayak

Former Member
0 Kudos

hi,

Structure is the single line that consists of certain fields of certain types. Can hold only 1 line.

While internal table can be of type any structure. Can hold many lines.

Regards,

Kunjal

VB09104
Active Participant
0 Kudos

Hi Pramodh,

Struture is a just template containg all your fields.

internal table is also a template of fields but can hold data in it.

structure do not contain any data..

regards,

vikas

plz reward if useful..

Former Member
0 Kudos

Hi Pramodh,

Strusture is one line is is able to store on record only,

Internal table can store multiple line ( Like Arrays in C Language).

Reward if useful,

Mahi.

Former Member
0 Kudos

hi,

In structure u can declare fields but it cant hold data.

In internal table u can hold data.

U can declare fields in one structure and that structure u can assign to internal table.....

Former Member
0 Kudos

What is the difference between internal table and structure?

There are there types of structure:-

1. Flat structure( elementary fields)

2. Nested structure ( type reference to other structure)

3. deep structure ( type reference to database tables)

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2fcc358411d1829f0000e829fbfe/content.htm">http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2fcc358411d1829f0000e829fbfe/content.htm</a>

if it is useful plz reward me.

Former Member
0 Kudos

internal tables are local to a particular program.

structures are global.

internal tables can hold data.

structures cannot hold data.

any prg can use structure,but as told earlier internal tables are specific to a program.

former_member699750
Participant
0 Kudos

1.Structure is a group of fields that can store only one line at a time

2.Internal table can store multiple values

3.Internal table of one program can not be used in another program.

4.But once u create a structure it can be used in any program again and again.

Structure has three types..

a.Elementary Structure

b.Nested Structure and

c.Deep structure