In a recent discussion I've seen someone was testing whether a loop was executed by placing a WRITE statement inside. Maybe it was a beginner's error but maybe others tend to do that too. Since the discussion is locked, I say it here:
WRITE is not appropriate for error analysis.
WRITE writes to he list buffer. A display of the list buffer in form of a classic list only takes place after calling the list. An automatic call of a classic list happens only in the program flow of a submitted executable program. As a rule, in any other framework there is no automatic list display. Therefore, the fact that you don't see any list output normally does not allow you to conclude that the WRITE statement was not executed.
- For finding bugs during development, you use checkpoints (breakpoints, assertions, logpoints).
- For testing during and after development you use module tests of ABAP Unit.
For the most of you this is crystal clear, but sometimes I get the impression that the knowledge about the fundamentals of classic ABAP programming - that unfortunately can freely be mixed into all the modern stuff - is taking a backseat more and more. Reminds me of the old days when I started with ABAP and also believed that WRITE is simply a kind of printf for creating a console output.