Skip to Content
Author's profile photo Gustavo Pereira

Inline declaration… you will love it!

Release 7.40 has some great news, one of them is something that impacts day-to-day coding agility : inline declaration.

What about use a variable without going to the top of your program and declaring it?  Yes, you can do it, especially if you are working locally (inside a code block) and not going to use it anywhere else.

A simple text variable:

DATA(text) = ‘Hello’.

OK, this is not a big deal.. since you may use a declaration like that:

DATA text TYPE string VALUE ‘Hello’.

But a really helpful one is when using Field-Symbols:


Or even better, within SQL statements:

SELECT carrname AS name, carrid AS id
       FROM   scarr
       INTO TABLE @DATA(result).

Looking foward to use it in a day-to-day basis! 🙂

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo vamsilakshman pendurti
      vamsilakshman pendurti


      Good feature ,

      I Have One Doubt in the above SELECT statement..that  you are using @(ITAB) ..

      without mention WHERE Condition ...

      What will be the Statement when we want to use WHERE Condition..



      Author's profile photo Gustavo Pereira
      Gustavo Pereira
      Blog Post Author

      you can use where condition as before. In my example would be

      SELECT carrname AS name, carrid AS id
             FROM   scarr
             INTO TABLE @DATA(result)

             WHERE carrid EQ '001'.

      The only difference is adding comma (,) between selected fields and @ to variables at condition, e.g.:

             WHERE carrid EQ @lv_carrid.

      This is an old post... I'm proud to now use it on my daily coding! 😉