MESSAGE is easy to use for the display of transient data and can be placed almost anywhere in our C/AL code. All it requires of the user is acknowledgement that the message has been read. The disadvantage of messages is that they are not displayed until either the object completes its run or pauses for some other external action. Plus, if we inadvertently create a situation that generates hundreds or thousands of messages, there is no graceful way to terminate their display once they begin displaying.
It's common to use MESSAGE as the elementary trace tool. We can program the display of messages to occur only under particular circumstances and use them to view either the flow of processing (by outputting simple identifying codes from different points in our logic) or to view the contents of particular data elements through multiple processing cycles.
MESSAGE has the following syntax: MESSAGE (String [, Value1] , ...]), where there are as many ValueX entries as there are %X substitution strings (up to 10).
Here is a sample debugging message:
MESSAGE('Loop %1, Item No. %2',LoopCounter,"Item No.");
The display would look as shown in the following screenshot (when the counter was 14 and the Item No. was BX0925):