Tuesday, December 16, 2008

Structures

Structures
->In R/3 a structure is a description of a group of fields.
->It describes the field names, their sequence, and their data types and lengths.
->Each structure has a name that is unique within the entire R/3 system.
->A structure cannot have the same name as a table.
->A structure name can be used in two ways:
* In a program, a structure name can be used to allocate memory for a group of fields.
* In a table, a structure name can be used to describe a set of fields.
Strictly speaking, a structure is something that only exists within the R/3 Data Dictionary. If you see the word structure, you should immediately think "DDIC structure."
In a program ,structure is used to store different type and size variables in the memory in a sequential manner.
DATA: Begin of struct-name ,
field1,
field2,
fieldn,
End of struct-name .

Eg: DATA:BEGIN OF employee,
eid(5) TYPE N,
ename(20) TYPE C,
END OF emp.

Accessing the elements is by 'employee-eid'.
Nesting of structure is also possible.

In a table structure is :
-> Collection of fields.
-> Stores the description of fields
-> Exists only within the R/3 DDIC.
-> It has no associated database table
-> No primary key
-> No technical attributes
-> We use structures if we want to define the same work area in multiple programs.
Eg:If you want to write a record to a sequential file using one prg and read them using another ,both the prgs should know about the layout of the records.

No comments:

Post a Comment