what is the difference table type and structure?
Answer Posted / 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 |
Post New Answer View All Answers
Explain enhancements
What are logical databases?
What are the events in ABAP language?
singleton class
any one can tell me which is the tables can store in ddic plese dont say db02l,please give me different ways of resideing the tables ?
Does the call transaction method allow multiple transactions to be processed by sap?
Is a logical database a requirement/must to write an abap/4 query?
What are the types of search helps? : sap abap data dictionary
Is sap xi intended to replace ale?
How can we set the table spaces and extent sizes? : abap data dictionary
How do you read files from the application server ? : abap bdc
How to create report in SD open sales order which covers all Organization, delivery status, shipping details and partner function details. plz mention the detail coding Tahnks, Rahul
i want to add 2 records to a table but the last field in the table is 1000 char long.Is it possible?if yes how?
How do you get the number of lines in an internal table? How to use a specific number occurs statement?
How do you document ABAP programs? Do you use program documentation menu option?