Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Inline declaration... you will love it!

$
0
0

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:

 

LOOP AT itab ASSIGNING FIELD-SYMBOL(<line>).


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!


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>