Code: Alles auswählen.
LOOP AT Tabelle1 ASSIGNING <Tabelle1>.
LOOP AT Tabelle2 ASSIGNING <Tabelle2>.
IF <Tabelle1>-X = <Tabelle2>-A
AND <Tabelle1>-Y BETWEEN <Tabelle2>-B AND <Tabelle2>-C.
MOVE: <Tabelle2>-D TO <Tabelle1>-Z,
ENDIF.
ENDLOOP.
ENDLOOP.
Entweder das füllen der ITABs ändern.Bjuti hat geschrieben:Nur leider ist dies nicht sehr performant. Habt ihr eine Idee? Die Tabellen sind interne Tabellen.
sollte folgendes coding auch recht performant sein:While with standard tables all rows of the internal table are checked for the logical expression of the WHERE- addition, with sorted tables and hash tables (as of Release 7.0) you can achieve optimized access by checking that at least the beginning part of the table key in sorted tables and the entire table key in hash tables is equal in the logical expression through queries linked with AND. Optimization also takes effect if the logical expression contains other queries linked with AND with arbitrary operators.
Code: Alles auswählen.
data: tabelle2 type sorted table of "table type"
with non-unique key a b c.
LOOP AT Tabelle1 ASSIGNING <Tabelle1>.
LOOP AT Tabelle2 ASSIGNING <Tabelle2>
where a = <Tabelle1>-X
and b <= <Tabelle1>-Y
and c => <Tabelle1>-Y.
MOVE: <Tabelle2>-D TO <Tabelle1>-Z.
ENDLOOP.
ENDLOOP.