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: 

what is the actual use of a structure?

Former Member
0 Kudos

what is the actual use of a structure? is there any situation where structure is unavoidable?

1 ACCEPTED SOLUTION

0 Kudos

Hi,

A structure if created in DDIC(Data Dictionary) is a global DATA STRUCTURE which is used to group related information, for example you would group all the details of your bank account into a structure BANK_ACCOUNT that contains fields like account_Id, account_holder_name etc.

If you create a structure in your program then it is local to your program. So you use this structure to create data holders of this DATA TYPE to hold data in your program.

STRUCTURE is similar to structure in any other programming language like "C".

Hope its clear now.

Regards,

Sesh

4 REPLIES 4

0 Kudos

Hi,

A structure if created in DDIC(Data Dictionary) is a global DATA STRUCTURE which is used to group related information, for example you would group all the details of your bank account into a structure BANK_ACCOUNT that contains fields like account_Id, account_holder_name etc.

If you create a structure in your program then it is local to your program. So you use this structure to create data holders of this DATA TYPE to hold data in your program.

STRUCTURE is similar to structure in any other programming language like "C".

Hope its clear now.

Regards,

Sesh

Former Member
0 Kudos

Structures globally define the data structure occurring in program calculations or when data is passed between programs.

Structures are used in particular to define the data at the interface of module pools and screens and to define the types of the parameters of reusable forms or function modules.

Structures are defined (almost) exactly like tables, but no database tables are generated from them. The same data elements and domains can be used in structures as in tables. Tables can also be included.

A structure (structured type) consists of components (fields) whose types are defined.

A component can have an elementary type, a structured type, a table type or a reference type.

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

Structures that are used more than once can be changed centrally because they were defined centrall. The active ABAP Dictionary makes this change at all relevant locations. ABAP programs or screen templates that use a structure are automatically adjusted when the structure changes.

Former Member
0 Kudos

Hi,

May be this ll help u.

Structures

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.

Internal Tables

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

i048168
Advisor
Advisor
0 Kudos

Hi,

Structure is used when different types of data has to be collected under one common types to map the real world entity. For example 'address' is the real world entity which involved many different data types to be combined and represented as the single structure.

Address - structure

- Name - string field

- Street name - string field

- house number - string / number depending on the data

- city - string field

- pincode - integer field

For many situation like these structures are inevitable.

Regards

Vadi