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: 

difference between structure and table

Former Member
0 Kudos

Hi friends

can any one tell what is the difference between structure and table

Thanks

Devi

7 REPLIES 7

Former Member
0 Kudos

Hi

The structure is a flat "structure", so it can't be used to stored the data, but only to manage the variable, so to define a work area for a program, for the dynpro or to define the parameters of the interface of the functions or the methods.

U can include a structure in a table: so this table'll have the same "structure" of the structure (or a part of the "structure" of the table is like the structure).

So the structure ia an easy way to organize severals data belonging to the same business.

Max

Former Member
0 Kudos

Hi,

A data model is an abstraction of a part of the real world which is represented using formal structures. A relational database basically uses one formal structure known as a table.

A table can be defined as a two−dimensional matrix made of rows and columns. It can also be described as a group of records of the same type.Records are groups of fields based on existing data types. These data types are previously defined in the datadictionary. A table is a similar concept to a conventional indexed file; the difference is that in the relational model the main index is known as the primary key, which is made of one or more fields of the record. A record is also known as tuple or simply a row. The most significant feature of the primary key is that it identifies univocally one and only one record of the table: a table does not permit records with duplicated primary keys.

<b>Structures</b>. The object structure refers to the definition of a compound object that does not have any content. It's like a table or a view, but it never has entries: it's only a structure. These types of objects are used in programs for defining data structures or for defining data in the interfaces from the module pools and the screens. The basic difference between structures and tables (or views) is that the

structure does not exist at the underlying database system level; however, both tables and views do exist in the database. Structures only exist as definitions in the dictionary. As a result, structures do not need to be activated.

<b>Table</b>. As previously explained, a table is a two&#8722;dimensional data matrix. A table can contain zero or many rows, corresponding to the predefined table structure (entity type). This is, at the same time, a complex structure, which can be made up of one or several fields (attributes). Every row that makes up the database table has the same structure and properties. The fields that make up the structure of the table records, as well as its attributes, permitted value range, and so on, are set when defining the table.

Chk these links for more information about internal tables

Some general recommendations for internal tables:

• As long as all that you need from an internal table is to append lines to it and perhaps to sort it after filling it, standard tables are still the best choice. The other table kinds are too expen-sive for these simple tasks. Keep in mind that when inserting or deleting lines in index tables containing many lines, the administration of the logical index that manages the lines of the ta-ble internally can become expensive, with regard to performance and additional memory space. Only for standard tables that are filled with APPEND only, and where no lines are de-leted except for the last line, is there no need for a logical index, and hence

no additional costs are incurred.

•If memory space is an issue, for very large internal tables (> 500000 lines) with a

small line size, sorted tables might be preferable to hashed tables, since for internal administration, they need only 6 bytes per line compared to 18 bytes for hashed tables.

•When declaring internal tables, use the addition INITIAL SIZE only for inner tables in nested tables. For outer tables, the automatic allocation of initial memory size is appropriate. For inner tables, though, it may result in saving a large amount of memory.

•When reading internal tables with READ TABLE or LOOP AT, choose the appropriate output behavior. Writing into a work area wa with the addition INTO wa is only necessary if you want to change the work area without influencing the internal table. For pure reading purposes or for modifying the contents of the internal table, the additions ASSIGNING <fs> for assigning internal table lines to a field symbol <fs> and REFERENCE INTO dref for setting a refer-ence in a data reference variable dref to internal table lines are the better choices by far.

•Use CLEAR instead of REFRESH for internal tables. The reason is that for internal tables with-out header lines, the general statement CLEAR does exactly the same as the special state-ment REFRESH. Since internal tables with header lines should no longer be used, the state-ment REFRESH is effectively obsolete. In order to free more memory, you can consider the use of FREE.

•The statement COLLECT should no longer be used for standard tables — use COLLECT mainly for hashed tables. The reason is that COLLECT is based on a hash algorithm. While the hash administration of a hashed table is always available and robust, for standard tables a temporary hash administration must be created when the COLLECT statement is used. This temporary hash administration is invalidated when the table is accessed for changing. If fur-ther COLLECT statements are entered after an invalidation, a linear search of all table rows must be performed. Furthermore, COLLECT only works properly on internal tables with unique lines, while a unique table key is guaranteed for hashed tables only. Therefore, for standard tables it cannot be guaranteed that the contents will always be suitable for editing using COLLECT.

•Don’t use APPEND SORTED BY — use SORT instead. The reason is that creating a ranked list with APPEND SORTED BY is based on several assumptions about the internal table and how it is filled. Using SORT is the general method that can be applied to all kinds of table and inde-pendent from the mode of filling.

Regards,

Balaji Reddy G

**Rewards for helpful answers

Former Member
0 Kudos

Hi rama,

Structure is a flat structure. We can just read data into it and place it into a table.Table is used to store data. Table may be a database table or an internal table. Database tables are stored in database where as internal tables are created during the program. We read data froma structure and place it into internal table.

-Priyanka.

Former Member
0 Kudos

<removed>

Removed Response, exact copy of post from Balaji Reddy G

Message was edited by:

Rich Heilman

Former Member
0 Kudos

Hi,

As everyone has said, structure does not hold data, its just an entity in the data dictionary. Whereas, table can store data.

For eg: BDCMSGCOLL is a structure used in BDC call transactions. You declare an internal table of that strucutre to store your values. Once your program starts executing, the internal table is filled and on completion it expires.

So you dont have to store these values in a table for future reference.

Difference in lay-man's words.

Regards

Subramanian.

Former Member
0 Kudos

Hi,

Structures are constructed the almost the same way as tables, the only difference using that <b>no database table is generated from them</b>.

Structures can contain data only during the runtime of a program. That too one record at a time.

Tables can hold data but structures cannot other than runtime. Whenever we need the same set of fields in several tables, we will go for a structure and include it in tables. For example, consider Address is a structure which contains Street, City, Pin as its components. Whenever u need a Address field u can include this structure. Instead everytime creating the same fields tideosly.

Hope this will help u.

U. Uma

Former Member
0 Kudos

To understand the difference between the structure and a table, just go thru the simple code that i have written.

types : begin of itab_type, <----


This skeleton is a structure

customer_no type c, which will not be assigned any

telephone_no type c, memory to use data.

end of itab_type.

data : itab type itab_type occurs 0. <----This is Table using the above structure

that can store data & is allocated memory to do so