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

Re: For all entries in ABAP

$
0
0

Hi Sumeet,

 

like the other people above have already said, the FOR ALL ENTRIES addition in the SELECT or OPEN CURSOR statement essentially is a JOIN between an internal table and a database table.

 

The only reason the FOR ALL ENTRIES addition was added to the SELECT Statement is, that there was no JOIN at that time, because the behaviour of the different database systems has been very different in the past.

 

Nowadays we discourage the usage of FOR ALL ENTRIES because:

 

1. Performance might be worse than a join, because there might be not 1 but many SELECT statements executed against the database. The results are later combined in the ABAP kernel.

 

2. An implicit DISTINCT semantic is applied, most users are not aware of. This is a source of subtle programming bugs.

 

3. Many things, like COUNT(*) are done in the kernel layer and not on the database, where they belong.

 

Principally all new Open SQL constructs, like expressions, don't work together with FOR ALL ENTRIES anymore. If ABAP gets to know a concept like HANA's global/local temporary tables one day, the FOR ALL ENTRIES addition will be totally obsolete and can be replaced by a "real" join executed on the database.

 

What we observe often is that some data is SELECTed into an internal table which in turn is combined via FOR ALL ENTRIES with the next SELECT statement. This should be generally avoided. With SQL expressions most of these cases can be done in a single JOIN. For data which really comes from the ABAP layer you have to stick with FOR ALL ENTRIES or use your own "temporary table" concept until we eventually get those global/local temp-tables.

 

 

Best regards,

Kilian.


Viewing all articles
Browse latest Browse all 8808

Trending Articles



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