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 | 20 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 |
what is Initialization Purpose?
in report gui we are giving customer number if it is wrong entry then how to write the code to restrict wrong entry?
How can the standard tables of sap be modified?
How can you change the style of Logo or type of Logo?
what is the difference table type and structure?
8 Answers IBM, Reliance, Tech Mahindra,
which institute is best in hyderabad for abap which is a module in sap.please suggest ur valuable information
Batch Monitor -- Transaction Code?
what does it mean occurs 0 while creating an internal table ?
if data is inserted only using bdc open and bdc insert and not bdc close session funx module wat will happend? will data b inserted?
What is lock mechanism? How do we create lock objects in abap?
After transferring of data from flat file to application server i found that it is showing wrong data .Say i had currency in flat file as 1000.00 USD. After transferring i found it is showing as 100.000 in the application server. How will you handle this case?
what is the flag?