Please refer to the following link
& please find the following code at the beginning of the program
REPORT DEMO. DATA: SUM TYPE I, CNT TYPE I. NODES: SPFLI, SFLIGHT, SBOOK. DATA: TAB_SPFLI TYPE TABLE OF SPFLI, TAB_SFLIGHT TYPE TABLE OF SFLIGHT, TAB_SBOOK TYPE TABLE OF SBOOK.
Q] M y question is that why instead of "LIKE" we are using"TYPE" here?
The basic difference between TYPE and LIKE
- When you want to create a data object referring to a data type then you use TYPE
- When you want to create a data object referring to an already existing data object then you use LIKE
This could be understood well with the following analogy:
You can say "Saurav is rich" or you can say "Saurav is LIKE Bill Gates". In the first statement you are referring to a TYPE (Rich) whereas in the second statement you are refferring to an already existing (Rich Person)
Refer here for technical attribute.</b>
Now when you only want the technical attribute of SPFLI-CARRID that is say NUMC of length 10 then you create a variable using TYPE. When you want to use the details like field formatting/ field labels etc then you create a variable using LIKE.
In your example VAR TYPE SPFLI-CARRID, this means VAR is a variable with NUMC as type and length 10. VAR LIKE SPFLI-CARRID means VAR is a variable with NUMC as type and length 10 and the field format and labels exactly same as that of the field SPFLI-CARRID.