ABAP Plus – Inline Declaration
Data declaration is an essential part of ABAP so that compiler can understand the variable properly. With the advancement in compilers, now the compilers are strong enough to understand the variables from the context and hence, there is no need for separate data declaration. To facilitate, SAP has introduced Inline Data Declaration – means data can be declared at the time of first use.
These syntaxes are available with release 7.40 (or onwards). Although the inline declaration also means that most of the time, the variable declaration is local in nature. I still use the normal data declaration if I have to create global variables (and place them in _TOP include).
Here are some examples (with explanation for inline data declaration). I will keep adding examples here.
- In a select statement.
- In a read statement.
- In a loop statement.
Feel free to post your thoughts/queries on inline data declaration.