Edit: First part of the answer is hidden as it is incorrect - see Vlad's comment & answer
Short answer to your question: The syntax does not allow you to do this as per the compiler message.
The best you can do is to combine the FORMAT and WRITE statements in a
macro, but this is very old-school, and will probably not teach you
too much that is relevant.
Have a look at package SLIS where there are many examples (BCALV_GRID*
) of how to implement ALV lists and grids. These are used much more frequently, even in Web Dynpro. The CL_SALV*
classes also provides a nice simplified (and supported) interface to implement ALV grids. (See this answer for a full example).