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


Please Help Members By Posting Answers For Below Questions

What will exactly the hide statement do?

574


How do you validate the selection criteria of a report? And how do you display initialvalues in a selection screen?

617


I am getting the (first) page number and the remaining records displayed in another list in another page BUT the PAGE Number is not displayed? What is the code/solution?

1537


Explain Catch Command in ABAP?

833


State the differences between database view & projection view? : abap data dictionary

612






BDC program to migrate data to SAP R/3 database. The data will be uploaded using transaction ME11. (Session Method) plz mention the detail coding Tahnks, Rahul

1619


How to split one Invoice into Multiple ( Step by Step)?

1707


Explain the Importance of pa20? : abap hr

633


When a program is created and need to be transported to prodn does selection texts always go with it? If not how do you make sure? Can you change the cts entries? How do you do it?

572


What is meant by authorization? Did you ever work on it? : sap abap hr

522


What are the update types possible?

612


Why grouping of fields is required? What is the max no of modification groups for each field?

562


How many default tab strips are there?

587


the problem is that , while i am undergoing with my practice session, i am creating too many new programs.they are occupying much space in my hard-disk. how to delete un-necessary programs completely from my data- base........... plz help me with this .....

1570


What are the events used in abap in the order of execution?

561