what is the difference table type and structure?
Answers were Sorted based on User's Feedback
Answer / apun
A table type has some database attached to it, whereas the
structure is only a definition with NO DATABASE attached to
it.
Is This Answer Correct ? | 47 Yes | 19 No |
Answer / srikanth@bigtec
Difference between structure and table type is
Table type
The table type specifies how you can access individual table
rows via ABAP.
Generally all internal tables are treated as table types.
There are different types of table types like
standard,sorted and hashed.
Internal tables are used only during program execution i.e
data flows into internal table only during program execution.
Data manipulations in internal table during debugging will
not effect database.No memory is allocated for table types
like internal table.
structure
Structure contains data only when it is inserted in database
table using append or include.
We change the data in structure which will effect Database.
Memory is allocated to structure only when it is included in
table using append or include.
Is This Answer Correct ? | 20 Yes | 6 No |
Answer / sandipan banerjea
first we should know what a structure is.it is a SINGLE row.
let us consider few examples:
1) DATA struc_xyz TYPE sflight.
here, we are declaring a structure variable by the name
"struc_xyz" which can hold the values for the same fields
which are present in "sflight".
if the fields present in "sflight" are say
"carrid","connid","fldate", then the structure variable
"struc_xyz" can hold the values for the above mentioned fields.
but suppose from "sflight" we want only "carrid", and
"connid", why should we use the whole of "sflight"?its a
performance issue.
2) TYPES:BEGIN OF abc,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF abc.
DATA struc_xyz TYPE abc.
here, "struc_xyz" is the structure variable and "abc" is a
local structure type which we have created using the keyword
TYPES.
now,let us move on to TABLE TYPE.
what does the word "TABLE" in "TABLE TYPE" suggest?!
the run time table variable which is nothing but the
internal table, is to be dealt with now.
3) TYPES gty_flights TYPE STANDARD TABLE OF sflight.
DATA itab_gty_flights TYPE gty_flights.
here, "gty_flights" is the local table type.THE TYPE OF AN
INTERNAL TABLE IS CALLED AS "TABLE TYPE".
"itab_gty_flights" is the internal table.
a common begineer's error is :
DATA itab_gty_flights TYPE STANDARD TABLE OF gty_flights.
in such a case, "itab_gty_flights" will be declared as an
internal table whose rows are themselves internal tables!!!
NOTE: i have used the keyword TYPES in examples 2 and 3.
they have declared a local structure type and a local table
type respectively.
you can declare both the types globally.refer the next two
examples below and compare with examples 2 and 3.i hope, you
will notice the differences!!
4)
DATA: BEGIN OF struc_xyz,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF struc_xyz.
5)
DATA itab_gty_flights TYPE STANDARD TABLE OF sflight.
************THANK YOU***********************************
Is This Answer Correct ? | 12 Yes | 2 No |
Answer / i.srikanth
Structures (structured types)
Structured types describe the structure and functions of any
structured data objects, that is of data structures with
components of any type.
A component can be a field with an elementary type or can
itself be a structure. A table can also be used as a
component in a structure.
A database table always has a structure and is therefore
implicitly a structured type. However, the fields of a
database table can only have an elementary type.
Table types
Table types describe the structure and functions of internal
tables in the ABAP program. Their rows can have any row
type. Table types with elementary row type therefore can be
defined just the same as multi-dimensional table types
(table types with a table type as row type) or table types
using structures with table-like components.
In a simple words,
Structure is just a flat structure but Table type is an
internal table.
Sample code how to use them to create internal table:
* Create Internal table from a structure:
DATA: IT_DATA TYPE STANDART TABLE OF Structure.
* Create Internal table from a table type:
DATA: IT_DATA TYPE table_type.
Is This Answer Correct ? | 9 Yes | 4 No |
Answer / yallamandaiah nandigam
1. Table can store the data physically but a structure dose not store.
2. Table can have primary key but a structure dose not have.
3. Table can have the technical attribute but a structure dose not have.
structure doesn't contain technical attributes.
structure doesn't contain primary key.
structure doesn't stores underline database level.
Is This Answer Correct ? | 8 Yes | 4 No |
Answer / ashok
1. Table can store the data physically but a structure dose not store.
2. Table can have primary key but a structure dose not have.
3. Table can have the technical attribute but a structure dose not have.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nag
structure means line type i.e work area of internal table
Table Type means Row type i.e body of internal table.
Is This Answer Correct ? | 9 Yes | 16 No |
Answer / uday
Stucture is line type which means body of internal table.
table type is row type which means workarea of IT.
Is This Answer Correct ? | 18 Yes | 44 No |
how can we change general report to alv report?
What is the difference between interfaces and abstract class
what is the role of ST05 in performance tuning?
what is the diffrence between driver program and print program in sap script
what client you are working?
Explain what is the significance of hide?
Why don’t use LSMW method instead of BDC methods, if the data is master data?
difference between bapi and rfc
How can one distinguish between different kinds of parameters? : abap modularization
wat are the SAPscript symbol?which of the following is not a SAPscript symbol?
What is the difference between LSMW and BDC?
List some of the many different ways that the sap standard functionality can be changed by a customer?