You cannot use offset in OPEN SQL.
I would recommend making SELECT into the internal table and iterate over it like that.
SELECT DISTINCT * FROM dbtab
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE field2 IN s_field2.
LOOP AT dbtab into wa_itab.
IF wa_itab-field1+7(16) IN s_field1
...
ENDIF.
ENDLOOP.
On the other hand, I would also define the internal table as SORTED or HASHED, or if you prefer to use SORT itab in the field that you do for comparison. Field characters can also be an alternative.
Hope this helps.
source
share