06-29-2007 6:02 AM
hai .....
What is the advantage of structures? How do you use them in the ABAP programs? can u explain this with an example?
06-29-2007 6:15 AM
HI.
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.
Reward all helpfull answers.
Regrads.
Jay
06-29-2007 6:06 AM
Hi,
Strucutre's are usful in grouping the related data.
That is if you want to represent a bank account it makes sense that we group all the required information and then use it as a DATA TYPE.
So strucutre are a way of creating user defined data types to group related information.
USE:
DATA: struct type SPFLI,
internal_ table type table of SPFLI.
Now you can store records of the table SPFLI in internal_table.
And then you can LOOP trhough the internal table and get one record at a time into the strucutre as follow.
LOOP AT internal_table into struct.
*struct will have the copy of a record for every loop pass
ENDLOOP.
.
06-29-2007 6:09 AM
A structure is just a list of fields defined under a name. Structures are useful for painting screen fields, and for manipulating data that has a consistent format defined by a discrete number of fields.
Structure in ABAP can not store data.
at DDIC level both are same but a table in SAP has mapping
to a table in the underlying database.
example
data: begin of emp_info,
emp_name(20) type c,
emp_age(3) type n,
end of emp_info.
06-29-2007 6:10 AM
Hi,
structures we can use as a work area.
for example see the structure SCREEN.
this structure we can use for changing the fields in the screens.
see this example.
parameters:i_matnr like mara-matnr,
i_mtart type mara-mtart.
at selection-screen output.
loop at screen.
if screen-name = 'I_MATNR'.
screen-required = '1'.
modify screen.
endif.
endloop.
rgds,
bharat.
06-29-2007 6:10 AM
Hi Pavan,
A structure (structured type) comprises components (fields). Types are defined for the components A component can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type. A structure can therefore be nested to any depth.
Structures are used to define the data at the interface of module pools and screens and to define the parameter types of function modules.
Logical Databse Structure:
The structure defines the data view of the logical database. It determines the structure of the other components and the behavior of the logical database at runtime. The order in which data is made available to the user depends on the hierarchical structure of the logical database concerned.
Reward if useful!
06-29-2007 6:15 AM
HI.
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.
Reward all helpfull answers.
Regrads.
Jay