Declaration of internal tables, an interesting case occurred
I just found something funny to make some objects, have two internal tables called itab1 and itab2, the itab1 is a TYPE SORTED TABLE coming from a TYPES statement called y_itab as show below:
Already itab2 was declared LIKE TABLE OF itab1 as shown above.
When performing code verification, SAP returns me with these two warnings below:
My question ... Knowing that the LIKE statement is used to declare an object when another has already been declared in the program (correct me if I'm wrong) and that the itab2 equals itab1, why these warnings occur?
PS: Do not post codes, post explanations, let's discourse oks?
Raphael Pacheco replied
Let the correct answer:
The statement should be presented only itab2 LIKE itab1 because itab2 received itab1 of characteristics correctly. Despite giving warning, the itab2 LIKE TABLE OF itab1 statement causes the SAPSQL_PARSER_TODO_WARNING dump when used in SQL query.
Why this happened:
The internal table systemically was assembled as follows:
So, in a more visible, it would thus be:
ITAB2 [ ITAB1[ FIELD1 , FIELD2 , ...] ] (Or also called as "TABLE_LINE").