Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Copying data from one internal table to another

former_member195355
Participant
0 Kudos

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

1 REPLY 1

SuhaSaha
Advisor
Advisor
0 Kudos

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