Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3180

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

$
0
0

Hi gurus,

 

On this example, wich table access do you think is more efficient?

 

Let's say I have an internal table with 50,000 rows, and I want to read two fields from one record.

 

Using classic READ TABLE statement, it will be something like that:

 

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

 

my_field_1 = <fs_record>-field_1.

my_field_2 = <fs_record>-field_2.

 

The desired record is searched once, and two fields are read.

 

Using new ABAP statement to access internal tables, the code can be somehing like that:

 

my_field_1 = t_table[ field = value ]-field_1.

my_field_2 = t_table[ field = value ]-field_2.

 

In my opinion, with this new statment, the desired record is seached twice, one for each field, so in this case READ TABLE is more efficient. Now imagine we need to read 10 fields insted of only two.

 

What's your opinion? Do you use new ABAP statements to manage internal tables, such as this one or LINE_EXISTS?

 

Regards.


Viewing all articles
Browse latest Browse all 3180

Trending Articles



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