Samstag, 20. Februar 2016

Creating field symbols on the way

Hello and welcome to "The Beautiful ABAP"

I'd like to start with a little peace of code which could save you a precious line of code here and there.
And most important: You don't need to jump between data declaration and actual coding.
Let's go!

As we all know a field symbol can be created and used like this:

field-symobols: <f1> like line of table.
...
loop at table assigning <f1>.
...
endloop.


A trick to do this slightly more elegant is this:
loop at table assigning field-symbol(<f1>).
...
endloop.

You can use this since ABAP 740. The keyword is "Inline declaration" and it will probably help us a lot more often in the future.

Have fun using this new feature!