Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2106

Re: READ TABLE vs New internal table acces in ABAP 7.40 and above. About efficiency.

$
0
0

I would start by just replacing

 

READ TABLE t_table ASSIGNING <fs_record> WITH KEY field = value.

 

with

 

ASSIGN t_table[ field = value ] TO FIELD-SYMBOL(<fs_record>).

 

and would probably end up creating a new the data structure that would let me write

 

my_fields = CORRESPONDING #( t_table[ field = value ] ).

 

So my opinion is that you are not comparing apples with apples. Check my sample Code.

 

ASSIGN is the drop-in replacement for READ TABLE, as you can check the SY-SUBRC after the statement. In other contexts, you can check with the LINE_EXISTS( ) / LINE_INDEX( ) functions to avoid triggering an exception.

With SP08+, the DEFAULT option of the VALUE operator can be used for memoization like

 

rv_index = VALUE #( MyCache[ object = is_object ]-index DEFAULT Method_To_Fetch_From_DB_Into_Cache_and_Return_IndexOf( is_object ) ).

 

I find the new syntax quite useful, but I challenge you (Horst Keller not included) to know the difference between a general expression position, a writer position and a reader position. I end up relying on the syntax check to tell me when I cannot use some constructs.

 

JNN


Viewing all articles
Browse latest Browse all 2106

Latest Images

Trending Articles



Latest Images

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