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
Difference between sap script and report?
What should be the approach for writing a bdc program? : abap bdc
if while coding power goes off , how to retrieve the codes?
Explain what is sap script? What is the purpose of sap script? Difference between sap script and report?
Can we create a gui status in a program from the object browser?
What are data classes? What are the various data classes available for selection? : abap data dictionary
What is a multiple line field?
What is the significance of technical settings (specified while creating a table in the data dictionary) ?
In Table Field when display the Name, whose first charecter should be capital letter and rest will be small letter.
Select up to 1 row and select single difference ?
What are client dependent objects in abap/sap?
Does sap handle multiple languages?
What are the types of subroutines? : abap modularization
What is meant by hide area?
what are the various types of parameters and how are they distinguished from one another?