rspec/rules/S2238/abap/rule.adoc

27 lines
991 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
In ``++SELECT ... FOR ALL ENTRIES++`` queries there are two internal tables: the driver internal table, and the target internal table. For each entry in the driver table some data from a database table is stored in the target internal table.
Most of the time, starting by sorting the content of the driver internal table offers improved performance. Indeed in such cases, from one request to another, the data read from the database tends to be much the same, and so for instance the use of database caching is maximised.
== Noncompliant Code Example
----
SELECT carrid , connid , seatsocc FROM flights
INTO TABLE seatsocc_tab
FOR ALL ENTRIES IN conn_tab
WHERE carrid = conn_tab-carrid
AND connid = conn_tab-connid
----
== Compliant Solution
----
SORT conn_tab BY carrid
...
SELECT carrid , connid , seatsocc FROM flights
INTO TABLE seatsocc_tab
FOR ALL ENTRIES IN conn_tab
WHERE carrid = conn_tab-carrid
AND connid = conn_tab-connid
----