09-11-2014 3:15 PM
Hiya,
I'm looking through some code that copies all the data from one internal table into another internal table, and saw this:
ITAB1[ ] = ITAB2.
CLEAR ITAB2.
I'm just curious as to how this is working, because I would have expected to see:
ITAB1[ ] = ITAB2[ ].
CLEAR ITAB2[ ].
Is it worth adjusting the first code so that it reads ITAB1[ ] = ITAB2[ ] or is it fine as it is?
Thanks in advance!
Moderator message - Unmarked as question.
Message was edited by: Suhas Saha
09-11-2014 3:50 PM
Accessing the whole internal table (and not just the header line) using square brackets[ ] is relevant for tables with header-line.
Since they are obsolete, i don't see the point of using [ ] to address the whole table. IMHO, this is redundant and i never use it in my code.
This is what ABAP Keyword Documentation has to say about it -
[ ] can be specified for internal tables without header line, but does not need to be. This is because the name (without [ ]) of an internal table without header line is interpreted as the table body in all operand positions regardless.
Same is the case with CLEAR & REFRESH constructs. I had stopped using REFRESH even before it was marked as obsolete