There is a rumor going around many SAP customers that SELECTS within itab loops should be eschewed in favor of FOR ALL ENTRIES IN ITAB constructions. This rumor persists despite an explicit warning in official SAP class material circa 2004-5 concerning the use and misuse of FOR ALL ENTRIES. Here’s why I think SAP is correct to warn folks about FOR ALL ENTRIES, and why there should be a concerted effort to disabuse clients of pipe-dreams concerning this construct. When one does a “FOR ALL ENTRIES IN itab” SELECT, one is really doing a bastardized join which relies on the skill of SAP developers rather than the skill of Oracle or DB2 developers. Why? Because half the raw stuff of the join is in the database (buffering considerations aside) and half is in ABAP or SAP memory (I don’t recall which, to be honest.) Now I am second to none in my respect for SAP developers, but no one is gonna convince me that SAP developers can do a join better than Oracle or DB2 internals. (This is not to say that Oracle and DB2 joins are anything to write home about – the only reason Codd is still spoken about in hushed and reverent tones is because the machines finally got sophisticated enough for DB2 and Oracle to implement parallelism. Otherwise, the relational paradigm would have already been consigned to the dustbin of history as the truly bad idea it really was.) Am I suggesting that developers use explicit DB joins instead of FOR ALL ENTRIES? To the contrary – I am arguing that SELECTS within LOOPS on itabs are still generally preferable when the number of record numbers is anything but trivially small, particularly when your SELECT within the LOOP can take advantage of explicit databse indices.. Your friendly DBAs will argue that the repetitive hits of the SELECTs in the iterated loop passes create a strain on the database. Well this may well be so but if it is, this is a problem in database implementation, not in coding practice. What, if you think about it, is the difference between one customer requesting repeating SELECTs and hundreds of customers requesting one SELECT each? If a DB can handle the latter reasonably well, shouldn’t it be able to handle the former equally well? So my question is: does SAP or anyone else have any real benchmark stats on FOR ALL ENTRIES vs indexed SELECTS within loops – stats for different numbers of records in the driver itabs? And my final comment in this post is: “Be careful of the paradigm you ask for – you may get it.” More on this thought later.