INNER JOIN itab2 on itab2FJ22 = itab1FJ12
INNER JOIN dbtab on dbtab FJ3 = itab1FJ13
WHERE … .
We may split this SELECT in a programmed way into two, using intermediate ITAB2_1.
The first SELECT will join ITAB2 and DBTAB (see basic approach) with the result
ITAB2_1. And the second will join our ITAB1 with ITAB2_1. ITAB2_1 must have such
BEGIN OF itab2_1 OCCURS 0,
f21 like itab2-f21,
f3 like dbtab-f3,
fj3 like dbtab-fj3, “ for join with ITAB1.
END OF itab2_1.
This is a very promising approach. Using intermediate internal tables we may permit
joins of illegal types from the ABAP point of view. For example: join by substring
of a field, join of cluster tables and so on.
In my implementation you only need one-two minutes for creation of a query including
3-5 DB tables with 5-10 output fields and select-options. The public version is
available in the Repository of
The program generation has a powerful advantage. If the generator gets some new
feature, for example the possibility of downloading of the resulting ITAB to a
local file and call EXCEL to open it, then all further generated programs obtain