When I first started learning ABAP, I was always not very clear about the definition of like/like table of/like line!
Write down your understanding for future reference. If this is not the case, please correct me!
Data: Begin of itab occurs 0,
Col1 type I,
Col2 type I,
End of itab.
* & * Internal table and Structure
Data: itab1a like itab. "defines a structure.
Data: itab1b like itab occurs 0. "defines an internal table without a header.
Data: itab1c like itab occurs 0 with header line. "defines an internal table with a header
* & Supports the internal table structure
Data: itab2b like table of itab. "defines an internal table without a header.
* *** Data: itab2b like table of itab occurs 0.
Data: itab2c like table of itab with header line. "defines a header
* ** & ** Only internal tables and structures can be followed.
Data: itab4a like line of itab. "defines a structure.
Data: itab4b like line of itab occurs 0. "defines an internal table without a header.
Data: itab4c like line of itab occurs 0 with header line. "defines a header
Do 7 times.
Itab-col1 = sy-index.
Itab-col2 = sy-index ** 2.
Append itab.
Enddo.
Move itab to itab1a.
Move itab [] to itab1b [].
Move itab to itab1c.
Move itab [] to itab2b [].
Move itab to itab2c.
Move itab to itab4a.
Move itab [] to itab4b [].
Move itab to itab4c.
*&***
Supplement the usage of like range:
Definitions: Data: itab like range of MARA-MATNR.
(The above sentence defines a table, the structure is ranges Table structure, low with high value type is the type of MARA-MATNR.