Both variants are possible, but they are semantically different: In the first version, the command CLEAR
is executed unconditionally, in the first version, it is only executed if lt_itab
contains at least one line. For the actual loop implementation, the difference is irrelevant, but for an empty table, the value of the variables in question differs after the ENDLOOP
statement is reached. This is not a problem as long as you handle empty tables sensibly... :-)
The only other micro-caveat of the second version is that AT FIRST
will clear all non-character fields of ls_wa
and set all character fields of ls_wa
to '*'.