More handy/useless ABAP info

Though it’s been a while, I feel I have to start the new year with something, just so you don’t think I have fallen off the planet. This time we look at another feature of ABAP, which you may call on one day when faced with a life-threatening situation deep in the African jungle, where only this piece of knowledge can save you, and you’ll be glad you read this post.

In ABAP, you can concatenate string literals with an ampersand (&). This allows your string literals to span several lines. I’m pretty sure this feature must have been around since the time when lines of ABAP code were limited to 72 characters. So you can do the following:

message 'The system has crashed and all your data has been lost.'
 & ' This is of course purely informational, so use it, don''t use'
 & ' it, it''s up to you. My suggestion would be to lie low until'
 & ' this has all blown over.' type 'I'.

Of course, it only works with string literals and not variables, otherwise it would have been a nice alternative to the CONCATENATE statement.

Happy coding! (Oh, and have a good 2009).

Tags: